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

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jul 20 10:12:42 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
990de75b by Steve Lhomme at 2024-07-20T09:38:10+00:00
magnify: check the image conversion worked

return NULL on failure as we cannot produce the required output.

Fixes #28707

- - - - -
19813291 by Steve Lhomme at 2024-07-20T09:38:10+00:00
opencv: check the image conversion worked

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

- - - - -


2 changed files:

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


Changes:

=====================================
modules/video_filter/magnify.c
=====================================
@@ -197,6 +197,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 );
@@ -220,6 +225,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_CopyPixels( p_outpic, p_converted );


=====================================
modules/video_filter/opencv_wrapper.c
=====================================
@@ -434,9 +434,16 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
                         p_sys->p_proc_image,
                         &(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_sys->i_internal_chroma == CINPUT ) {
             picture_CopyPixels( p_outpic, p_sys->p_proc_image );
             picture_CopyProperties( p_outpic, p_sys->p_proc_image );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/98441c0394b6e6c2c320e291d4ebb489e1b36043...19813291fcfb31ddd91a2e4d0f1d37ad3239d300

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/98441c0394b6e6c2c320e291d4ebb489e1b36043...19813291fcfb31ddd91a2e4d0f1d37ad3239d300
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