mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
aic: Validate values read from the bitstream
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
17d57848fc
commit
0f678c0214
@ -215,12 +215,14 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
|
|||||||
idx = -1;
|
idx = -1;
|
||||||
do {
|
do {
|
||||||
GET_CODE(val, skip_type, skip_bits);
|
GET_CODE(val, skip_type, skip_bits);
|
||||||
|
if (val < 0)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
idx += val + 1;
|
idx += val + 1;
|
||||||
if (idx >= num_coeffs)
|
if (idx >= num_coeffs)
|
||||||
break;
|
break;
|
||||||
GET_CODE(val, coeff_type, coeff_bits);
|
GET_CODE(val, coeff_type, coeff_bits);
|
||||||
val++;
|
val++;
|
||||||
if (val >= 0x10000)
|
if (val >= 0x10000 || val < 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
dst[scan[idx]] = val;
|
dst[scan[idx]] = val;
|
||||||
} while (idx < num_coeffs - 1);
|
} while (idx < num_coeffs - 1);
|
||||||
@ -230,7 +232,7 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
|
|||||||
for (mb = 0; mb < slice_width; mb++) {
|
for (mb = 0; mb < slice_width; mb++) {
|
||||||
for (idx = 0; idx < num_coeffs; idx++) {
|
for (idx = 0; idx < num_coeffs; idx++) {
|
||||||
GET_CODE(val, coeff_type, coeff_bits);
|
GET_CODE(val, coeff_type, coeff_bits);
|
||||||
if (val >= 0x10000)
|
if (val >= 0x10000 || val < 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
dst[scan[idx]] = val;
|
dst[scan[idx]] = val;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user