From 4ba9c7397e29f4e4cb82f720cc108a7434cc9413 Mon Sep 17 00:00:00 2001 From: Luka Rahne Date: Fri, 24 Jan 2025 05:52:43 +0100 Subject: [PATCH] fix: add handling to skip block data in ocf decoder readBlock method (#492) --- ocf/ocf.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ocf/ocf.go b/ocf/ocf.go index 7c2a05c..b3d7408 100644 --- a/ocf/ocf.go +++ b/ocf/ocf.go @@ -187,7 +187,8 @@ func (d *Decoder) readBlock() int64 { size := d.reader.ReadLong() // Read the blocks data - if count > 0 { + switch { + case count > 0: data := make([]byte, size) d.reader.Read(data) @@ -197,6 +198,11 @@ func (d *Decoder) readBlock() int64 { } d.resetReader.Reset(data) + + case size > 0: + // Skip the block data when count is 0 + data := make([]byte, size) + d.reader.Read(data) } // Read the sync.