[FFmpeg-devel] [PATCH] parser: Only store overread bytes if there are any in the buffer.

Justin Ruggles justin.ruggles
Wed Apr 22 04:46:56 CEST 2009


Ramiro Polla wrote:
> Hi,
> 
> On Tue, Apr 21, 2009 at 11:18 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Tue, Apr 21, 2009 at 09:41:45PM -0300, Ramiro Polla wrote:
>>> $subj
>>>
>>> Fixes crash with attached zuff'd file.
>> please elaborate on what goes wrong and why this fix is the correct way
>> to fix it
>> is last_index=0 really the only case that can trigger this?
> 
> I don't understand the parser code much. Justin said attached patch
> should fix it properly.

To elaborate... from what I can tell, this is what is happening currently.

1st pass:
major sync found at byte 4
mp->in_sync = 1
return 0

2nd pass:
nothing added to pc->buffer
try to read major sync header, but crc fails
mp->in_sync = 0
skip 1 byte

3rd pass:
sync found at byte 3
tries to ff_combine_frame() at position -1, but buffer is still empty so
it crashes

The patch I suggested to Ramiro buffers that 1 byte when sync is lost
instead of skipping it.

-Justin



More information about the ffmpeg-devel mailing list