magnify: check the image conversion worked
authorSteve Lhomme <robux4@ycbcr.xyz>
Thu, 18 Jul 2024 07:23:58 +0000 (09:23 +0200)
committerSebastian Ramacher <sramacher@debian.org>
Tue, 14 Jan 2025 22:09:47 +0000 (23:09 +0100)
return NULL on failure as we cannot produce the required output.

Fixes #28707

(cherry picked from commit 990de75bc0a7db5f2c4e4cb88e868b75b689ac7d) (rebased)
rebased:
- picture_CopyPixels is called picture_CopyVisiblePixels on 4.0
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Gbp-Pq: Name 0018-magnify-check-the-image-conversion-worked.patch

modules/video_filter/magnify.c

index 5f94f2d6fc2d48899b3002a85f1a0b2e04077de8..375e6e7f39d82000c6e1ac66b37f83dccae25a48 100644 (file)
@@ -244,6 +244,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         /* */
         fmt_out = p_filter->fmt_out.video;
         p_converted = image_Convert( p_sys->p_image, p_pic, &fmt_in, &fmt_out );
+        if (unlikely(!p_converted))
+        {
+            picture_Release( p_outpic );
+            return NULL;
+        }
         memcpy(p_pic->p, orig_planes, sizeof orig_planes);
 
         picture_CopyPixels( p_outpic, p_converted );
@@ -267,6 +272,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         fmt_out.i_height = fmt_out.i_visible_height = (fmt_out.i_visible_height/VIS_ZOOM) & ~1;
         p_converted = image_Convert( p_sys->p_image, p_pic,
                                      &p_pic->format, &fmt_out );
+        if (unlikely(!p_converted))
+        {
+            picture_Release( p_outpic );
+            return NULL;
+        }
 
         /* It will put only what can be copied at the top left */
         picture_CopyVisiblePixels( p_outpic, p_converted );