From 1c2c39e257625fd27a95e3ad911882e425a7e1eb Mon Sep 17 00:00:00 2001 From: Kim Yang Date: Fri, 21 Aug 2026 15:59:46 +0800 Subject: [PATCH] Fix BGZF truncation at embedded EOF markers --- src/bgzf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bgzf.h b/src/bgzf.h index 8ad92e62..eb6eb241 100644 --- a/src/bgzf.h +++ b/src/bgzf.h @@ -147,7 +147,9 @@ class BgzfMtReader { if (bsize == 28) { uint32_t isize = s.comp[24]|(s.comp[25]<<8)|(s.comp[26]<<16)|(s.comp[27]<<24); - if (isize == 0) { markDone(s); break; } + // An embedded BGZF EOF marker is just an empty block. It can + // appear when valid BGZF files are concatenated. + if (isize == 0) continue; } s.compLen = bsize;