[FFmpeg-devel] [PATCH]Decode some invalid wav files

Daniel Verkamp daniel
Wed Feb 10 21:30:43 CET 2010


On Wed, Feb 10, 2010 at 8:28 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Feb 09, 2010 at 08:21:39AM -0600, Daniel Verkamp wrote:
>> On Wed, Feb 3, 2010 at 12:16 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Wed, Feb 03, 2010 at 04:34:43AM -0600, Daniel Verkamp wrote:
>> >> On Mon, Feb 1, 2010 at 7:15 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>> >> > Daniel Verkamp <daniel <at> drv.nu> writes:
>> >> >
>> >> >> This doesn't look right - data_size is only set in the rf64 case (read
>> >> >> from a special rf64-only header), so it is some random value at this
>> >> >> point for a non-rf64 file. ?This probably works by accident (on my
>> >> >> system, it currently happens to get initialized to a large positive
>> >> >> value).
>> >> >
>> >> > Thanks for having a look and explaining.
>> >> >
>> >> > How can wav->data_end be set correctly?
>> >> >
>> >> > Carl Eugen
>> >> >
>> >>
>> >> Something like the attached looks like it should work (tested with -f
>> >> framecrc, results match for broken file and correct one). ?This just
>> >> assumes the data chunk runs until the end of the file if the size is
>> >> not valid. In theory this breaks actual 0-length files with more
>> >> chunks after the data chunk, but I doubt it should matter in practice.
>> >>
>> >> Thanks,
>> >> -- Daniel Verkamp
>> >
>> >> From 0b94931fab41318e3e2b3309a820acaede5eba81 Mon Sep 17 00:00:00 2001
>> >> From: Daniel Verkamp <daniel at drv.nu>
>> >> Date: Wed, 3 Feb 2010 05:24:24 -0500
>> >> Subject: [PATCH] Demux WAV files with data chunk size = 0
>> >
>> > why dont you just
>> > if(!size)size=MAX
>> > ?
>>
>> Something like this?
>>
>> Thanks,
>> -- Daniel Verkamp
>
>> From b76af183167828e20ffbb5cdea55753333002aba Mon Sep 17 00:00:00 2001
>> From: Daniel Verkamp <daniel at drv.nu>
>> Date: Tue, 9 Feb 2010 09:19:38 -0500
>> Subject: [PATCH] Fix demuxing of wav files with broken data header
>>
>> ---
>> ?libavformat/wav.c | ? ?3 +++
>> ?1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/libavformat/wav.c b/libavformat/wav.c
>> index f4b2d61..6298f46 100644
>> --- a/libavformat/wav.c
>> +++ b/libavformat/wav.c
>> @@ -227,6 +227,9 @@ static int wav_read_header(AVFormatContext *s,
>> ? ? ? ? ?size = data_size;
>> ? ? ?if (size < 0)
>> ? ? ? ? ?return -1;
>> + ? ?if (!size)
>> + ? ? ? ?wav->data_end = INT64_MAX;
>> + ? ?else
>
> with {} yes
>

Applied with {}.



More information about the ffmpeg-devel mailing list