]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dvdsub_parser.c
Merge commit 'a238b83b13640e3192d7d4aaad2242f13a9a84a1'
[ffmpeg] / libavcodec / dvdsub_parser.c
index e50c3396e4b658a30e46c1855864e5e35865aec1..32a945ed6532f227b5154cddd00dbd218b5be498 100644 (file)
@@ -45,8 +45,11 @@ static int dvdsub_parse(AVCodecParserContext *s,
     DVDSubParseContext *pc = s->priv_data;
 
     if (pc->packet_index == 0) {
-        if (buf_size < 2)
-            return 0;
+        if (buf_size < 2 || AV_RB16(buf) && buf_size < 6) {
+            if (buf_size)
+                av_log(avctx, AV_LOG_DEBUG, "Parser input %d too small\n", buf_size);
+            return buf_size;
+        }
         pc->packet_len = AV_RB16(buf);
         if (pc->packet_len == 0) /* HD-DVD subpicture packet */
             pc->packet_len = AV_RB32(buf+2);