aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-24 22:52:03 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-15 12:25:46 +0100
commit3ba68a54000078d4faed0cfe4106695f25b1d8a3 (patch)
tree280a36ba7e199120bd6c07b25cb8027eba5cbb8f /libavformat
parent386b987f2a8c4abe507d2d58136acc0ef4ace9a3 (diff)
downloadffmpeg-3ba68a54000078d4faed0cfe4106695f25b1d8a3.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>
Diffstat (limited to 'libavformat')
-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);
}