Commit 7dfa8040 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000_parser: Check state!=0

Fixes: out of array read
Fixes: 37664/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5893420460146688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 4d81550d
......@@ -142,7 +142,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
m->in_codestream = 0;
} else if (m->in_codestream && (state & 0xFFFF) == 0xFF90) { // Are we in tile part header?
m->read_tp = 8;
} else if (pc->frame_start_found && info_marker((state & 0xFFFF0000)>>16) && m->in_codestream) {
} else if (pc->frame_start_found && info_marker((state & 0xFFFF0000)>>16) && m->in_codestream && (state & 0xFFFF)) {
// Calculate number of bytes to skip to get to end of the next marker.
m->skip_bytes = (state & 0xFFFF)-1;
......
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