[FFmpeg-devel] [PATCH] fix parsing of broken mp3 streams
Mon Apr 20 21:37:25 CEST 2009
2009/4/19 Michael Niedermayer <michaelni at gmx.at>:
> On Sun, Apr 19, 2009 at 11:18:06PM +0200, Zdenek Kabelac wrote:
>> Here is a small patch that fixes of running out-of-buffer in parsing
>> broken mp3 data stream.
>> This solution is rather a hotfix - better solution would be to check
>> at least one or two next mp3
>> frames in sequence whether they are part of the same audio stream or
>> some random junk
>> which has 0xfffx header inside. With this patch ugly noise could be
>> sometimes noticed.
>> Also questionable is whether it should return -1 if no header is found
>> or rather return skipped
>> bytes and out_size = 0 - as then usually such packet is rescaned
>> multiple times with
>> one-byte step forward...
>> - Fix buffer overrun
>> - Properly return parsed bytes together with skipped bytes
> please provide a sample so we can confirm the bugfix, the patch
> looks mostly correct though
I've upload just one mp3 dumped stream upload.ffmpeg.org as
junk_at_mp3stream directory - together with short text and two patch
- I'm attaching patch for api-example.c to easily compare results.
Also ffplay seems to skip whole such data chunk it finds broken mp3
chunk in stream and makes then seeking somehow impossible - but fixing
properly this isn't an easy one-liner fix,
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1830 bytes
Desc: not available
More information about the ffmpeg-devel