On 11.07.2015 11:44, Luca Barbato wrote:
> On 11/07/15 01:26, Andreas Cadhalpun wrote:
>> Note however that the explode mode doesn't necessarily work, because e.g.
>> the avi demuxer doesn't set err_recognition for the AVCodecContext.
> 
> It wouldn't work as intended, setting the bit_rate to 0 thought, does
> prevent an issue with g726 but probably that chunk of code could be removed.
> 
> Some patches following...

After your riff patch, it is possible to the the explode mode working.
Updated patch attached.

Best regards,
Andreas

>From e7634d4f175841285d5481ef951c62c704efbcc3 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Sat, 11 Jul 2015 00:09:46 +0200
Subject: [PATCH] riffdec: prevent negative bit rate

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavformat/riffdec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 5ae9163..f798baf 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -107,6 +107,14 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
         codec->bit_rate    = avio_rb32(pb) * 8;
         codec->block_align = avio_rb16(pb);
     }
+    if (codec->bit_rate < 0) {
+        av_log(s, AV_LOG_WARNING,
+               "Invalid bit rate: %d\n", codec->bit_rate);
+        if (s->error_recognition & AV_EF_EXPLODE)
+            return AVERROR_INVALIDDATA;
+        else
+            codec->bit_rate = 0;
+    }
     if (size == 14) {  /* We're dealing with plain vanilla WAVEFORMAT */
         codec->bits_per_coded_sample = 8;
     } else {
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to