1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 18 Jul 2024 09:23:58 +0200
Subject: magnify: check the image conversion worked
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>
---
modules/video_filter/magnify.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c
index 5f94f2d..375e6e7 100644
--- a/modules/video_filter/magnify.c
+++ b/modules/video_filter/magnify.c
@@ -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 );
|