From b6372414e507319c619a5e63129b0956d46ffc6e Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 21 Jul 2023 08:59:22 -0400 Subject: [PATCH] tar/asm: don't add a padding entry if it has no bytes Fixes #65 if the read bytes is 0, then don't even create the entry for that padding. This sounds like the solution for the issue opened, but I haven't found a reproducer for this issue yet. :-\ Signed-off-by: Vincent Batts --- tar/asm/disassemble.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tar/asm/disassemble.go b/tar/asm/disassemble.go index 009b3f5..33cffba 100644 --- a/tar/asm/disassemble.go +++ b/tar/asm/disassemble.go @@ -135,6 +135,9 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io } isEOF = true } + if n == 0 { + break + } _, err = p.AddEntry(storage.Entry{ Type: storage.SegmentType, Payload: paddingChunk[:n],