[FFmpeg-cvslog] ff_alloc_picture: free tables in case of dimension mismatches
Michael Niedermayer
git at videolan.org
Tue Mar 12 03:31:00 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Mar 11 21:29:14 2013 +0100| [ee3c3dd523623e0d9e69aa2ce268fef82b201458] | committer: Michael Niedermayer
ff_alloc_picture: free tables in case of dimension mismatches
Fixes memory corruption
In theory this should not be needed but its better to check at
one place than to hope 50 other places set the flags correctly
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee3c3dd523623e0d9e69aa2ce268fef82b201458
---
libavcodec/mpegvideo.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 9fe93bf..d0c8262 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -411,6 +411,11 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
{
int i, ret;
+ if (pic->qscale_table_buf)
+ if (pic->mbskip_table_buf->size < s->mb_stride * s->mb_height + 2 ||
+ pic->qscale_table_buf->size < s->mb_stride * (s->mb_height + 1) + 1 + s->mb_stride)
+ free_picture_tables(pic);
+
if (shared) {
assert(pic->f.data[0]);
pic->shared = 1;
More information about the ffmpeg-cvslog
mailing list