[FFmpeg-cvslog] riffdec: prevent negative bit rate

Andreas Cadhalpun git at videolan.org
Thu Nov 26 01:54:07 CET 2015


ffmpeg | branch: release/2.4 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sat Jul 11 00:09:46 2015 +0200| [16cbc7a9303f6f876997c096306c9184222e64b3] | committer: Andreas Cadhalpun

riffdec: prevent negative bit rate

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 189420cb561929e05f5cc4224cdca83740a24a32)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=16cbc7a9303f6f876997c096306c9184222e64b3
---

 libavformat/riffdec.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 3462b42..3d4d5d0 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -91,6 +91,14 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
     codec->sample_rate = avio_rl32(pb);
     codec->bit_rate    = avio_rl32(pb) * 8;
     codec->block_align = avio_rl16(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



More information about the ffmpeg-cvslog mailing list