Hi,

attached patch fix context error noticed by valgrind. that error happens because of image size calculated by *avpicture_get_size* and *mlt_image_format_size* are different. In my case

avpicture_get_size(AV_PIX_FMT_YUYV422, 60, 68) == 8160
    => [ 68 * (2 * 60) ]

mlt_image_format_size(mlt_image_yuv422, 60, 68, NULL) == 8280
    => [ (68 + 1) * (2 * 60) ]

as result during copying it access area outside of allocated space...

--
________________________________________
Maksym Veremeyenko

>From 70a5bffe0d05b75d48c981e98527d972a3846176 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1stereo.tv>
Date: Thu, 8 Nov 2012 13:48:04 +0200
Subject: [PATCH] calc image size as largest of two image size calculation
 methods

---
 src/modules/avformat/filter_avcolour_space.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/modules/avformat/filter_avcolour_space.c b/src/modules/avformat/filter_avcolour_space.c
index 3e804e9..5bf53ea 100644
--- a/src/modules/avformat/filter_avcolour_space.c
+++ b/src/modules/avformat/filter_avcolour_space.c
@@ -169,7 +169,8 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo
 
 		int in_fmt = convert_mlt_to_av_cs( *format );
 		int out_fmt = convert_mlt_to_av_cs( output_format );
-		int size = avpicture_get_size( out_fmt, width, height );
+		int size = FFMAX( avpicture_get_size( out_fmt, width, height ),
+			mlt_image_format_size( output_format, width, height, NULL ) );
 		uint8_t *output = mlt_pool_alloc( size );
 
 		if ( *format == mlt_image_rgb24a || *format == mlt_image_opengl )
-- 
1.7.7.6

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to