mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-20 05:16:38 +00:00
h264: check for invalid zeros_left before writing
Prevent an invalid write into coeffs[scantable[-1]] if zeros_left itself was an invalid VLC code (and thus -1). Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
9a2e79116d
commit
ddd7559ad9
@ -610,17 +610,18 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zeros_left < 0) {
|
||||||
|
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||||
|
"negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
if (h->pixel_shift) {
|
if (h->pixel_shift) {
|
||||||
STORE_BLOCK(int32_t)
|
STORE_BLOCK(int32_t)
|
||||||
} else {
|
} else {
|
||||||
STORE_BLOCK(int16_t)
|
STORE_BLOCK(int16_t)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(zeros_left<0){
|
|
||||||
av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user