mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-22 07:20:45 +00:00
avcodec/mss2: Check for repeat overflow
Fixes: mss2_left_shift.wmv Found-by: Piotr Bandurski <ami_stuff@o2.pl> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
42c54d4cc3
commit
e273dade78
@ -210,8 +210,13 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride,
|
|||||||
last_symbol = b << 8 | bytestream2_get_byte(gB);
|
last_symbol = b << 8 | bytestream2_get_byte(gB);
|
||||||
else if (b > 129) {
|
else if (b > 129) {
|
||||||
repeat = 0;
|
repeat = 0;
|
||||||
while (b-- > 130)
|
while (b-- > 130) {
|
||||||
|
if (repeat >= (INT_MAX >> 8) - 1) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "repeat overflow\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
|
repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
|
||||||
|
}
|
||||||
if (last_symbol == -2) {
|
if (last_symbol == -2) {
|
||||||
int skip = FFMIN((unsigned)repeat, dst + w - p);
|
int skip = FFMIN((unsigned)repeat, dst + w - p);
|
||||||
repeat -= skip;
|
repeat -= skip;
|
||||||
|
Loading…
Reference in New Issue
Block a user