aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-24 22:52:03 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:48 +0100
commit1487993fae238bfa6480a9c84b2e3d960614872d (patch)
treec19d9875f8a4397e027b456b80bbec6340065e77
parentd8658b51b75c0c57d9f72014590ca12ac1831436 (diff)
downloadffmpeg-1487993fae238bfa6480a9c84b2e3d960614872d.tar.gz
avformat/shortendec: Check k in probe
Fixes: Assertion failure Fixes: 17640/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5708767475269632 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 ea770eb55941a6ed7b86828d6ea2f4e718a4b337) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/shortendec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/shortendec.c b/libavformat/shortendec.c
index 42fcdf75c3..97f4d66130 100644
--- a/libavformat/shortendec.c
+++ b/libavformat/shortendec.c
@@ -40,12 +40,18 @@ static int shn_probe(AVProbeData *p)
channels = get_ur_golomb_shorten(&gb, 0);
blocksize = 256;
} else {
- int k;
+ unsigned k;
k = get_ur_golomb_shorten(&gb, 2);
+ if (k > 31)
+ return 0;
internal_ftype = get_ur_golomb_shorten(&gb, k);
k = get_ur_golomb_shorten(&gb, 2);
+ if (k > 31)
+ return 0;
channels = get_ur_golomb_shorten(&gb, k);
k = get_ur_golomb_shorten(&gb, 2);
+ if (k > 31)
+ return 0;
blocksize = get_ur_golomb_shorten(&gb, k);
}