avcodec/h264_ps: Fix runtime error: signed integer overflow: 2147483647 + 26 cannot...
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 21 Mar 2017 23:17:05 +0000 (00:17 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 23 Mar 2017 14:25:48 +0000 (15:25 +0100)
Fixes: 902/clusterfuzz-testcase-4561155144024064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h264_ps.c

index 65d164d81c673100e2a36a66e0e551fbd4c99978..b78ad251f5c1ed2a19e4ecad1a8bdb959f34e5ec 100644 (file)
@@ -800,8 +800,8 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
 
     pps->weighted_pred                        = get_bits1(gb);
     pps->weighted_bipred_idc                  = get_bits(gb, 2);
-    pps->init_qp                              = get_se_golomb(gb) + 26 + qp_bd_offset;
-    pps->init_qs                              = get_se_golomb(gb) + 26 + qp_bd_offset;
+    pps->init_qp                              = get_se_golomb(gb) + 26U + qp_bd_offset;
+    pps->init_qs                              = get_se_golomb(gb) + 26U + qp_bd_offset;
     pps->chroma_qp_index_offset[0]            = get_se_golomb(gb);
     if (pps->chroma_qp_index_offset[0] < -12 || pps->chroma_qp_index_offset[0] > 12) {
         ret = AVERROR_INVALIDDATA;