mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-23 15:53:08 +00:00
dpx: perform width/height upgrade and av_image_check_size earlier to prevent segfault on malformed input
Signed-off-by: Peter Ross <pross@xvid.org>
This commit is contained in:
parent
5a3370816f
commit
f2dc82b90f
@ -104,6 +104,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
buf = avpkt->data + 0x304;
|
||||
w = read32(&buf, endian);
|
||||
h = read32(&buf, endian);
|
||||
if (av_image_check_size(w, h, 0, avctx))
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (w != avctx->width || h != avctx->height)
|
||||
avcodec_set_dimensions(avctx, w, h);
|
||||
|
||||
// Need to end in 0x320 to read the descriptor
|
||||
buf += 20;
|
||||
@ -182,10 +187,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (s->picture.data[0])
|
||||
avctx->release_buffer(avctx, &s->picture);
|
||||
if (av_image_check_size(w, h, 0, avctx))
|
||||
return -1;
|
||||
if (w != avctx->width || h != avctx->height)
|
||||
avcodec_set_dimensions(avctx, w, h);
|
||||
if (avctx->get_buffer(avctx, p) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user