mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
iff: fix integer overflow
Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
7992bdbeb4
commit
3dbc0ff9c3
@ -250,6 +250,8 @@ static int iff_read_header(AVFormatContext *s)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CMAP:
|
case ID_CMAP:
|
||||||
|
if (data_size > INT_MAX - IFF_EXTRA_VIDEO_SIZE - FF_INPUT_BUFFER_PADDING_SIZE)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
st->codec->extradata_size = data_size + IFF_EXTRA_VIDEO_SIZE;
|
st->codec->extradata_size = data_size + IFF_EXTRA_VIDEO_SIZE;
|
||||||
st->codec->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
|
st->codec->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
if (!st->codec->extradata)
|
if (!st->codec->extradata)
|
||||||
@ -410,6 +412,7 @@ static int iff_read_header(AVFormatContext *s)
|
|||||||
if (!st->codec->extradata)
|
if (!st->codec->extradata)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
av_assert0(st->codec->extradata_size >= IFF_EXTRA_VIDEO_SIZE);
|
||||||
buf = st->codec->extradata;
|
buf = st->codec->extradata;
|
||||||
bytestream_put_be16(&buf, IFF_EXTRA_VIDEO_SIZE);
|
bytestream_put_be16(&buf, IFF_EXTRA_VIDEO_SIZE);
|
||||||
bytestream_put_byte(&buf, iff->bitmap_compression);
|
bytestream_put_byte(&buf, iff->bitmap_compression);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user