Commit 1b006003 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000dec: Fix division by zero in jp2_find_codestream()

Fixes: 2707/clusterfuzz-testcase-minimized-5179636394754048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 74c1c22d
...@@ -2075,6 +2075,11 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s) ...@@ -2075,6 +2075,11 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
hden = bytestream2_get_be16u(&s->g); hden = bytestream2_get_be16u(&s->g);
vexp = bytestream2_get_byteu(&s->g); vexp = bytestream2_get_byteu(&s->g);
hexp = bytestream2_get_byteu(&s->g); hexp = bytestream2_get_byteu(&s->g);
if (!vnum || !vden || !hnum || !vden) {
bytestream2_seek(&s->g, atom2_end, SEEK_SET);
av_log(s->avctx, AV_LOG_WARNING, "RES box invalid\n");
continue;
}
if (vexp > hexp) { if (vexp > hexp) {
vexp -= hexp; vexp -= hexp;
hexp = 0; hexp = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment