aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-24 03:15:23 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-30 23:26:03 +0100
commit93437a18d878f3924199a3dba5082aa3d09a3094 (patch)
tree06b056bca63bfbc1bbe02ab45f012b2f85b76dc2
parentd07f78ae726bbc8cde010f530676e53468acfa53 (diff)
downloadffmpeg-93437a18d878f3924199a3dba5082aa3d09a3094.tar.gz
avcodec/hevc_ps: Check log2_sao_offset_scale_*
Fixes: 4868/clusterfuzz-testcase-minimized-6236542906400768 Fixes: runtime error: shift exponent 126 is too large for 32-bit type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4a75a75c62efc645ec28444e4675c325b8f2bb1a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/hevc_ps.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 902917d4dd..2ab4c34013 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1324,6 +1324,11 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
pps->log2_sao_offset_scale_luma = get_ue_golomb_long(gb);
pps->log2_sao_offset_scale_chroma = get_ue_golomb_long(gb);
+ if ( pps->log2_sao_offset_scale_luma > FFMAX(sps->bit_depth - 10, 0)
+ || pps->log2_sao_offset_scale_chroma > FFMAX(sps->bit_depth_chroma - 10, 0)
+ )
+ return AVERROR_INVALIDDATA;
+
return(0);
}