avcodec/h264_cavlc: Fix undefined behavior on qscale overflow

Fixes: 1214/clusterfuzz-testcase-minimized-6130606599569408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/254/merge
Michael Niedermayer 8 years ago
parent 207e6debf8
commit fc8cff96ed
  1. 2
      libavcodec/h264_cavlc.c

@ -1112,7 +1112,7 @@ decode_intra_mb:
dquant= get_se_golomb(&sl->gb);
sl->qscale += dquant;
sl->qscale += (unsigned)dquant;
if (((unsigned)sl->qscale) > max_qp){
if (sl->qscale < 0) sl->qscale += max_qp + 1;

Loading…
Cancel
Save