aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_ps.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-22 13:36:52 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-23 02:37:55 +0100
commit9568b2e425f127031ddc91dd78cb9b9f2cae206d (patch)
tree4999364c4d9a0eb0a5d1c78aff2bc752d31dae9c /libavcodec/h264_ps.c
parentc104556448973802606205fe45b8535c647354ea (diff)
downloadffmpeg-9568b2e425f127031ddc91dd78cb9b9f2cae206d.tar.gz
avcodec/h264_ps: Check chroma_qp_index_offset
Fixes: 647/clusterfuzz-testcase-5195745823031296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Reviewed-by: BBB Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r--libavcodec/h264_ps.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 8090178395..f384ef23c3 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -828,6 +828,11 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
pps->init_qp = get_se_golomb(gb) + 26 + qp_bd_offset;
pps->init_qs = get_se_golomb(gb) + 26 + 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;
+ goto fail;
+ }
+
pps->deblocking_filter_parameters_present = get_bits1(gb);
pps->constrained_intra_pred = get_bits1(gb);
pps->redundant_pic_cnt_present = get_bits1(gb);
@@ -845,6 +850,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
pps->scaling_matrix4, pps->scaling_matrix8);
// second_chroma_qp_index_offset
pps->chroma_qp_index_offset[1] = get_se_golomb(gb);
+ if (pps->chroma_qp_index_offset[1] < -12 || pps->chroma_qp_index_offset[1] > 12) {
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
} else {
pps->chroma_qp_index_offset[1] = pps->chroma_qp_index_offset[0];
}