[FFmpeg-cvslog] avcodec/h264_cavlc: Fix undefined behavior on qscale overflow

Michael Niedermayer git at videolan.org
Sat Apr 22 23:40:34 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Apr 22 21:59:29 2017 +0200| [fc8cff96ed45dfdb91ed03e9942845f28be0e770] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc8cff96ed45dfdb91ed03e9942845f28be0e770
---

 libavcodec/h264_cavlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 069b52129c..72dfaaab45 100644
--- a/libavcodec/h264_cavlc.c
+++ b/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;



More information about the ffmpeg-cvslog mailing list