[FFmpeg-cvslog] voc_packet: validate sample_rate

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


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Oct 23 17:19:20 2016 +0200| [54b8fbbc5dc9b74e0a96d7730bfacc8bc1b59e85] | committer: Andreas Cadhalpun

voc_packet: validate sample_rate

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

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/voc_packet.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/voc_packet.c b/libavformat/voc_packet.c
index 5833a79..0d56436 100644
--- a/libavformat/voc_packet.c
+++ b/libavformat/voc_packet.c
@@ -106,6 +106,11 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
         }
     }
 
+    if (par->sample_rate <= 0) {
+        av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", par->sample_rate);
+        return AVERROR_INVALIDDATA;
+    }
+
     if (tmp_codec >= 0) {
         tmp_codec = ff_codec_get_id(ff_voc_codec_tags, tmp_codec);
         if (par->codec_id == AV_CODEC_ID_NONE)



More information about the ffmpeg-cvslog mailing list