diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-11-25 22:42:07 +0100 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-12-18 19:48:30 +0100 |
commit | f1d8763a02b5fce9a7d9789e049d74a45b15e1e8 (patch) | |
tree | c319ee271c465de1c768fb61d6f51bea0c33d465 /libavcodec/mpegvideo_enc.c | |
parent | ed2d7d5868a4a5d914f1e5488d63ea696a3b2937 (diff) | |
download | ffmpeg-f1d8763a02b5fce9a7d9789e049d74a45b15e1e8.tar.gz |
mpegvideo: allocate scratch buffers after linesize is known
Since we can't know which stride a custom get_buffer() implementation is
going to use we have to allocate this scratch buffers after the linesize
is known. It was pretty safe for 8 bit per pixel pixel formats since we
always allocated memory for up to 16 bits per pixel. It broke hoever
with cmdutis.c's alloc_buffer() and high pixel bit depth since it
allocated larger edges than mpegvideo expected.
Fixes fuzzed sample nasa-8s2.ts_s244342.
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 7c92ad2374..816f44caf2 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3107,7 +3107,7 @@ static void set_frame_distances(MpegEncContext * s){ static int encode_picture(MpegEncContext *s, int picture_number) { - int i; + int i, ret; int bits; int context_count = s->slice_context_count; @@ -3150,7 +3150,9 @@ static int encode_picture(MpegEncContext *s, int picture_number) s->mb_intra=0; //for the rate distortion & bit compare functions for(i=1; i<context_count; i++){ - ff_update_duplicate_context(s->thread_context[i], s); + ret = ff_update_duplicate_context(s->thread_context[i], s); + if (ret < 0) + return ret; } if(ff_init_me(s)<0) |