[FFmpeg-cvslog] bfi: validate sample_rate

Andreas Cadhalpun git at videolan.org
Mon Nov 7 01:54:00 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Oct 23 15:54:01 2016 +0200| [872fcfcc0f01230ef761e286b0c6a18817e0a162] | committer: Andreas Cadhalpun

bfi: validate sample_rate

A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/bfi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 568363d..ef4c17d 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -88,6 +88,10 @@ static int bfi_read_header(AVFormatContext * s)
                vstream->codecpar->extradata_size);
 
     astream->codecpar->sample_rate = avio_rl32(pb);
+    if (astream->codecpar->sample_rate <= 0) {
+        av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", astream->codecpar->sample_rate);
+        return AVERROR_INVALIDDATA;
+    }
 
     /* Set up the video codec... */
     avpriv_set_pts_info(vstream, 32, 1, fps);



More information about the ffmpeg-cvslog mailing list