From 54ca161fd074a7ba17d9aed8479da189374eb64e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 1 Feb 2024 13:28:38 +0100 Subject: [PATCH] Add some asserts; sws_getContext() will fail if the image width or height are 0. --- src/lib/image.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/image.cc b/src/lib/image.cc index 801b39b0f..4c60fe888 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -339,6 +339,10 @@ Image::scale (dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_fo the input image alignment is not PADDED. */ DCPOMATIC_ASSERT (alignment() == Alignment::PADDED); + DCPOMATIC_ASSERT(size().width > 0); + DCPOMATIC_ASSERT(size().height > 0); + DCPOMATIC_ASSERT(out_size.width > 0); + DCPOMATIC_ASSERT(out_size.height > 0); auto scaled = make_shared(out_format, out_size, out_alignment); auto scale_context = sws_getContext ( -- 2.30.2