avcodec/hevc_ps: Check default display window bitstream and skip if invalid
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 27 Oct 2014 13:03:09 +0000 (14:03 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 27 Oct 2014 13:03:09 +0000 (14:03 +0100)
Fixes Ticket4035

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/hevc_ps.c

index c17ca04..4e1c561 100644 (file)
@@ -525,7 +525,11 @@ static void decode_vui(HEVCContext *s, HEVCSPS *sps)
     vui->field_seq_flag                = get_bits1(gb);
     vui->frame_field_info_present_flag = get_bits1(gb);
 
-    vui->default_display_window_flag = get_bits1(gb);
+    if (get_bits_left(gb) >= 68 && show_bits_long(gb, 21) == 0x100000) {
+        vui->default_display_window_flag = 0;
+        av_log(s->avctx, AV_LOG_WARNING, "Invalid default display window\n");
+    } else
+        vui->default_display_window_flag = get_bits1(gb);
     // Backup context in case an alternate header is detected
     memcpy(&backup, gb, sizeof(backup));