[FFmpeg-devel] [PATCH] riffdec: error out on negative bit rate

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Jul 11 00:39:09 CEST 2015


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

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index eebd8ed..be55699 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -106,6 +106,11 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size, int big_
         codec->bit_rate    = avio_rb32(pb) * 8;
         codec->block_align = avio_rb16(pb);
     }
+    if (codec->bit_rate < 0) {
+        av_log(NULL, AV_LOG_ERROR,
+               "Invalid bit rate: %d\n", codec->bit_rate);
+        return AVERROR_INVALIDDATA;
+    }
     if (size == 14) {  /* We're dealing with plain vanilla WAVEFORMAT */
         codec->bits_per_coded_sample = 8;
     } else {
-- 
2.1.4


More information about the ffmpeg-devel mailing list