diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 44c81db86c..d037071f92 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -793,11 +793,13 @@ static int jpeg_probe(const AVProbeData *p) state = EOI; break; case APP0: - if (AV_RL32(&b[i + 4]) == MKTAG('J','F','I','F')) + if (c == APP0 && AV_RL32(&b[i + 4]) == MKTAG('J','F','I','F')) got_header = 1; + /* fallthrough */ case APP1: - if (AV_RL32(&b[i + 4]) == MKTAG('E','x','i','f')) + if (c == APP1 && AV_RL32(&b[i + 4]) == MKTAG('E','x','i','f')) got_header = 1; + /* fallthrough */ case APP2: case APP3: case APP4: