[vlc-commits] magnify: fix invalid usage of copied pictures

Thomas Guillem git at videolan.org
Thu Mar 16 18:11:55 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 16 18:08:19 2017 +0100| [3b12ded948896ed9e890bb1166b1ded8fde2f689] | committer: Thomas Guillem

magnify: fix invalid usage of copied pictures

This fixes a crash when the copied picture is held by picture_Hold, since the
private side of the picture was not copied.

Ref #18116

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b12ded948896ed9e890bb1166b1ded8fde2f689
---

 modules/video_filter/magnify.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c
index d11f540..697769f 100644
--- a/modules/video_filter/magnify.c
+++ b/modules/video_filter/magnify.c
@@ -178,15 +178,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     {
         video_format_t fmt_in;
         video_format_t fmt_out;
-        picture_t crop;
+        plane_t orig_planes[PICTURE_PLANE_MAX];
+        memcpy(orig_planes, p_pic->p, sizeof orig_planes);
 
-        crop = *p_pic;
         for( int i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
         {
             const int o_yp = o_y * p_outpic->p[i_plane].i_lines / p_outpic->p[Y_PLANE].i_lines;
             const int o_xp = o_x * p_outpic->p[i_plane].i_pitch / p_outpic->p[Y_PLANE].i_pitch;
 
-            crop.p[i_plane].p_pixels += o_yp * p_pic->p[i_plane].i_pitch + o_xp;
+            p_pic->p[i_plane].p_pixels += o_yp * p_pic->p[i_plane].i_pitch + o_xp;
         }
 
         /* */
@@ -196,8 +196,8 @@ 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, &crop, &fmt_in, &fmt_out );
+        p_converted = image_Convert( p_sys->p_image, p_pic, &fmt_in, &fmt_out );
+        memcpy(p_pic->p, orig_planes, sizeof orig_planes);
 
         picture_CopyPixels( p_outpic, p_converted );
 



More information about the vlc-commits mailing list