[FFmpeg-cvslog] avformat/oggparseopus: Check opus_duration() return value

James Almer git at videolan.org
Thu Dec 12 17:32:16 CET 2013


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Dec 12 03:34:19 2013 -0300| [c619e14c314b44d86a8d552259afb957c0b6775d] | committer: Michael Niedermayer

avformat/oggparseopus: Check opus_duration() return value

Regression since 39d11d599cd292485fe991cd22e10d7a1738b3bc

os->pduration would be wrongly assigned a negative value on invalid packets
instead of aborting.

Signed-off-by: James Almer <jamrial at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/oggparseopus.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index edcb7b4..aafefbb 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -109,6 +109,7 @@ static int opus_packet(AVFormatContext *avf, int idx)
     AVStream *st                 = avf->streams[idx];
     struct oggopus_private *priv = os->private;
     uint8_t *packet              = os->buf + os->pstart;
+    int ret;
 
     if (!os->psize)
         return AVERROR_INVALIDDATA;
@@ -144,7 +145,10 @@ static int opus_packet(AVFormatContext *avf, int idx)
         os->lastdts                 = os->granule - duration;
     }
 
-    os->pduration = opus_duration(packet, os->psize);
+    if ((ret = opus_duration(packet, os->psize)) < 0)
+        return ret;
+
+    os->pduration = ret;
     if (os->lastpts != AV_NOPTS_VALUE) {
         if (st->start_time == AV_NOPTS_VALUE)
             st->start_time = os->lastpts;



More information about the ffmpeg-cvslog mailing list