[FFmpeg-devel] [PATCH]lavf/wavdec: Allow decoding of invalid large wav files

Carl Eugen Hoyos cehoyos at ag.or.at
Fri May 8 20:01:15 CEST 2015


Hi!

Valid wav files are not larger than 4G, files that are 
larger are truncated by current FFmpeg.
Attached patch allows reading such files if the size 
was (imo "correctly") written to -1.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 410c2ec..332f643 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -335,9 +335,12 @@ static int wav_read_header(AVFormatContext *s)
 
             if (rf64) {
                 next_tag_ofs = wav->data_end = avio_tell(pb) + data_size;
-            } else {
+            } else if (size != 0xFFFFFFFF) {
                 data_size    = size;
                 next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX;
+            } else {
+                data_size    = 0;
+                next_tag_ofs = wav->data_end = INT64_MAX;
             }
 
             data_ofs = avio_tell(pb);


More information about the ffmpeg-devel mailing list