[FFmpeg-cvslog] oggparsedirac: check return value of init_get_bits

Chris Watkins git at videolan.org
Thu Aug 20 14:53:46 CEST 2015


ffmpeg | branch: release/2.4 | Chris Watkins <watk at chromium.org> | Tue Jul  7 10:23:44 2015 -0700| [3fb241210af6000ec16aed5e1b445a6b12a367a7] | committer: Michael Niedermayer

oggparsedirac: check return value of init_get_bits

If init_get_bits fails the GetBitContext is invalid and must not be
used. Check the return value in dirac_header and propogate the error.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 4f5c2e651a95b950f6a3fb36f2342cbc32515f17)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/oggparsedirac.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
index 73bc495..26d42f3 100644
--- a/libavformat/oggparsedirac.c
+++ b/libavformat/oggparsedirac.c
@@ -31,14 +31,19 @@ static int dirac_header(AVFormatContext *s, int idx)
     AVStream *st = s->streams[idx];
     dirac_source_params source;
     GetBitContext gb;
+    int ret;
 
     // already parsed the header
     if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
         return 0;
 
-    init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
-    if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
-        return -1;
+    ret = init_get_bits8(&gb, os->buf + os->pstart + 13, (os->psize - 13));
+    if (ret < 0)
+        return ret;
+
+    ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source);
+    if (ret < 0)
+        return ret;
 
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = AV_CODEC_ID_DIRAC;



More information about the ffmpeg-cvslog mailing list