]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp3.c
avcodec/utvideoenc: Don't use bitcounts when byte-aligned
[ffmpeg] / libavcodec / vp3.c
index cf64a8c61e4767c60f279e5f8c79445fd17e6d6f..57c6eb1ff9812ab7073a00dd0b8588b6ee3470c8 100644 (file)
@@ -35,6 +35,7 @@
 #include <string.h>
 
 #include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
 
 #include "avcodec.h"
 #include "get_bits.h"
@@ -2874,6 +2875,9 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     int ret;
     AVRational fps, aspect;
 
+    if (get_bits_left(gb) < 206)
+        return AVERROR_INVALIDDATA;
+
     s->theora_header = 0;
     s->theora = get_bits(gb, 24);
     av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);