aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-12-15 17:50:12 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-08 23:19:14 +0100
commit34cad2f0e2bdd580564fc1eaadaee851f714da5c (patch)
treec83bb1a851e7e3055660a16f3ccdeaa92fa46646
parentce2804775527e1f1a1f837614b74c76aed3613c8 (diff)
downloadffmpeg-34cad2f0e2bdd580564fc1eaadaee851f714da5c.tar.gz
avcodec/hevc_sei: Fix integer overflows in decode_nal_sei_message()
Fixes: signed integer overflow: 2147483520 + 255 cannot be represented in type 'int' Fixes: 4554/clusterfuzz-testcase-minimized-4843714515042304 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 991ef6e5b9a6a9d95e274ff6bff52db1c82b3808) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/hevc_sei.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 971350e0af..019cbfdd60 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -344,11 +344,15 @@ static int decode_nal_sei_message(HEVCContext *s)
av_log(s->avctx, AV_LOG_DEBUG, "Decoding SEI\n");
while (byte == 0xFF) {
+ if (get_bits_left(gb) < 16 || payload_type > INT_MAX - 255)
+ return AVERROR_INVALIDDATA;
byte = get_bits(gb, 8);
payload_type += byte;
}
byte = 0xFF;
while (byte == 0xFF) {
+ if (get_bits_left(gb) < 8 + 8LL*payload_size)
+ return AVERROR_INVALIDDATA;
byte = get_bits(gb, 8);
payload_size += byte;
}