Browse code

avcodec/dvbsubdec: Fix buf_size check in dvbsub_parse_display_definition_segment()

Fixes Ticket4326

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

banastasov authored on 2015/05/30 11:28:39
Showing 1 changed files
... ...
@@ -1504,10 +1504,10 @@ static int dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
1504 1504
         avctx->height = display_def->height;
1505 1505
     }
1506 1506
 
1507
-    if (buf_size < 13)
1508
-        return AVERROR_INVALIDDATA;
1509
-
1510 1507
     if (info_byte & 1<<3) { // display_window_flag
1508
+        if (buf_size < 13)
1509
+            return AVERROR_INVALIDDATA;
1510
+
1511 1511
         display_def->x = bytestream_get_be16(&buf);
1512 1512
         display_def->width  = bytestream_get_be16(&buf) - display_def->x + 1;
1513 1513
         display_def->y = bytestream_get_be16(&buf);