mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
h263: Check init_get_bits return value
And use init_get_bits8 to check for integer overflows while at it. CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
0749314886
commit
aaaf2dc023
@ -405,12 +405,15 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) // divx 5.01+/xvid frame reorder
|
if (s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) // divx 5.01+/xvid frame reorder
|
||||||
init_get_bits(&s->gb, s->bitstream_buffer,
|
ret = init_get_bits8(&s->gb, s->bitstream_buffer,
|
||||||
s->bitstream_buffer_size * 8);
|
s->bitstream_buffer_size);
|
||||||
else
|
else
|
||||||
init_get_bits(&s->gb, buf, buf_size * 8);
|
ret = init_get_bits8(&s->gb, buf, buf_size);
|
||||||
s->bitstream_buffer_size = 0;
|
s->bitstream_buffer_size = 0;
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (!s->context_initialized)
|
if (!s->context_initialized)
|
||||||
// we need the idct permutaton for reading a custom matrix
|
// we need the idct permutaton for reading a custom matrix
|
||||||
if ((ret = ff_MPV_common_init(s)) < 0)
|
if ((ret = ff_MPV_common_init(s)) < 0)
|
||||||
@ -434,9 +437,11 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
if (s->avctx->extradata_size && s->picture_number == 0) {
|
if (s->avctx->extradata_size && s->picture_number == 0) {
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
|
|
||||||
init_get_bits(&gb, s->avctx->extradata,
|
ret = init_get_bits8(&gb, s->avctx->extradata,
|
||||||
s->avctx->extradata_size * 8);
|
s->avctx->extradata_size);
|
||||||
ret = ff_mpeg4_decode_picture_header(s, &gb);
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
ff_mpeg4_decode_picture_header(s, &gb);
|
||||||
}
|
}
|
||||||
ret = ff_mpeg4_decode_picture_header(s, &s->gb);
|
ret = ff_mpeg4_decode_picture_header(s, &s->gb);
|
||||||
} else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
|
} else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
|
||||||
|
Loading…
Reference in New Issue
Block a user