Check for EOF
authornpzacs <npzacs@gmail.com>
Wed, 11 Oct 2017 06:44:54 +0000 (09:44 +0300)
committernpzacs <npzacs@gmail.com>
Wed, 11 Oct 2017 07:31:35 +0000 (10:31 +0300)
src/libbluray/bdnav/clpi_parse.c

index 6cf4f86..312c10f 100644 (file)
@@ -117,6 +117,11 @@ _parse_header(BITSTREAM *bits, CLPI_CL *cl)
         return 0;
     }
 
+    if (bs_avail(bits) < 5 * 32) {
+        BD_DEBUG(DBG_NAV | DBG_CRIT, "_parse_header: unexpected end of file\n");
+        return 0;
+    }
+
     cl->sequence_info_start_addr = bs_read(bits, 32);
     cl->program_info_start_addr = bs_read(bits, 32);
     cl->cpi_start_addr = bs_read(bits, 32);