From 54cf775dca5e96a07ef910e3796d13a97ee8f0c6 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 9 Feb 2019 23:39:03 +0100 Subject: [PATCH] Fix truncated MULs --- src/layout/blocked_mul.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layout/blocked_mul.c b/src/layout/blocked_mul.c index e9a4944a..c19d65a8 100644 --- a/src/layout/blocked_mul.c +++ b/src/layout/blocked_mul.c @@ -28,10 +28,14 @@ void block_update_mul(off_t block_offset, VGMSTREAM * vgmstream) { data_header = 0x00; data_size = 0; } - if (block_type == 0x00 && block_size != 0) { + else if (block_type == 0x00 && block_size != 0) { /* read audio sub-header */ data_size = read_32bit(block_offset + block_header + 0x00,streamFile); } + else if (block_type < 0) { + /* EOF/bad read */ + data_size = -1; + } else { /* non-audio or empty audio block */ data_header = 0x00;