aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-16 19:57:08 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-16 20:32:39 +0200
commitdfb61ea2630029b7aec7911aade769bf1a914eea (patch)
tree400767f60d5e2736bc3edec4685672135f2dfaf7 /libavcodec
parent16d6cc2168b66c75a5dfe772d778360c2c8f3f5a (diff)
downloadffmpeg-dfb61ea2630029b7aec7911aade769bf1a914eea.tar.gz
avcodec/jpeg2000dec: Check nonzerobits more completely
Fixes: runtime error: shift exponent 36 is too large for 32-bit type 'int' Fixes: 2239/clusterfuzz-testcase-minimized-5639766592716800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jpeg2000dec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 09b72933f2..c3d2747675 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -960,9 +960,9 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
if (!cblk->npasses) {
int v = expn[bandno] + numgbits - 1 -
tag_tree_decode(s, prec->zerobits + cblkno, 100);
- if (v < 0) {
+ if (v < 0 || v > 30) {
av_log(s->avctx, AV_LOG_ERROR,
- "nonzerobits %d invalid\n", v);
+ "nonzerobits %d invalid or unsupported\n", v);
return AVERROR_INVALIDDATA;
}
cblk->nonzerobits = v;