[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: magnify: check the image conversion worked

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jul 23 05:20:56 UTC 2024



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
34186002 by Steve Lhomme at 2024-07-22T07:03:52+02:00
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 at ycbcr.xyz>

- - - - -
890c81a8 by Steve Lhomme at 2024-07-22T07:04:44+02:00
opencv: check the image conversion worked

Otherwise we release the output picture that would have been used and returned.

(cherry picked from commit 19813291fcfb31ddd91a2e4d0f1d37ad3239d300) (rebased)
rebased:
- p_filter->p_sys is p_sys on 4.0
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


2 changed files:

- modules/video_filter/magnify.c
- modules/video_filter/opencv_wrapper.c


Changes:

=====================================
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 );


=====================================
modules/video_filter/opencv_wrapper.c
=====================================
@@ -444,9 +444,16 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
                         p_filter->p_sys->p_proc_image,
                         &(p_filter->p_sys->p_proc_image->format),
                         &fmt_out );
-
-            picture_CopyPixels( p_outpic, p_outpic_tmp );
-            CopyInfoAndRelease( p_outpic, p_outpic_tmp );
+            if (unlikely(!p_outpic_tmp))
+            {
+                picture_Release(p_outpic);
+                p_outpic = NULL;
+            }
+            else
+            {
+                picture_CopyPixels( p_outpic, p_outpic_tmp );
+                CopyInfoAndRelease( p_outpic, p_outpic_tmp );
+            }
         } else if( p_filter->p_sys->i_internal_chroma == CINPUT ) {
             picture_CopyPixels( p_outpic, p_filter->p_sys->p_proc_image );
             picture_CopyProperties( p_outpic, p_filter->p_sys->p_proc_image );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/56d0aca2566775ca572c61a725cfbce373cf6d97...890c81a87124970d0492dbd22ae0c4ef01507824

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/56d0aca2566775ca572c61a725cfbce373cf6d97...890c81a87124970d0492dbd22ae0c4ef01507824
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list