OSDN Git Service

mpegvideo: allocate scratch buffers after linesize is known
authorJanne Grunau <janne-libav@jannau.net>
Sun, 25 Nov 2012 21:42:07 +0000 (22:42 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Tue, 18 Dec 2012 18:48:30 +0000 (19:48 +0100)
commitf1d8763a02b5fce9a7d9789e049d74a45b15e1e8
treec319ee271c465de1c768fb61d6f51bea0c33d465
parented2d7d5868a4a5d914f1e5488d63ea696a3b2937
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.
libavcodec/h264.c
libavcodec/mpeg12.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c