avcodec/mjpeg_parser: skip markers after EOI, not by size
The check for m->size >= 0xF000 is intended to avoid skipping too much garbage data between JPEG frames in test_roman (thus missing next SOI), but it erroneously also skips valid markers between SOI and SOS. Instead of this, we should simply skip parsing markers other than SOI after EOI. That way, we will not accidentally skip over SOI due to some garbage between frames. There is still a small risk of encountering FFD8 in the garbage data, but the chance of this is fairly low. Fixes: https://trac.ffmpeg.org/ticket/8967 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2cddb2f7a8
commit
cd0bdce71a
@ -80,10 +80,10 @@ static int find_frame_end(MJPEGParserContext *m, const uint8_t *buf, int buf_siz
|
||||
pc->frame_start_found=0;
|
||||
pc->state=0;
|
||||
return i-3;
|
||||
} else if((state>>16)==0xFFD9 && (state&0xFFFF)!=0xFFD8){
|
||||
state= 0xFFD900|(state&0xFF);
|
||||
} else if(state<0xFFD00000 || state>0xFFD9FFFF){
|
||||
m->size= (state&0xFFFF)-1;
|
||||
if (m->size >= 0xF000)
|
||||
m->size = 0;
|
||||
}
|
||||
}
|
||||
if(m->size>0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user