Add some asserts; sws_getContext() will fail if the image width or height are 0.
authorCarl Hetherington <cth@carlh.net>
Thu, 1 Feb 2024 12:28:38 +0000 (13:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 3 Feb 2024 08:57:25 +0000 (09:57 +0100)
src/lib/image.cc

index 801b39b0fced2f9feba50b9371e500d0c4b28bdc..4c60fe8886fca9be82a3ea741390049c7f83dbf2 100644 (file)
@@ -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<Image>(out_format, out_size, out_alignment);
        auto scale_context = sws_getContext (