func TestLargeJunkPadding(t *testing.T) {
	pR, pW := io.Pipe()
	go func() {
		tw := tar.NewWriter(pW)
		if err := tw.Close(); err != nil {
			pW.CloseWithError(err)
			t.Fatal(err)
			return
		}
		const (
			junkChunkSize = 64 * 1024 * 1024
			junkChunkNum  = 20 * 16
		)
		devZero, err := os.Open("/dev/zero")
		if err != nil {
			pW.CloseWithError(err)
			t.Fatal(err)
			return
		}
		defer devZero.Close()
		for i := 0; i < junkChunkNum; i++ {
			if i%32 == 0 {
				fmt.Fprintf(os.Stderr, "[TestLargeJunkPadding] junk chunk #%d/#%d\n", i, junkChunkNum)
			}
			if _, err := io.CopyN(pW, devZero, junkChunkSize); err != nil {
				pW.CloseWithError(err)
				t.Fatal(err)
				return
			}
		}
		fmt.Fprintln(os.Stderr, "[TestLargeJunkPadding] junk chunk finished")
		pW.Close()
	}()
	nilPacker := storage.NewJSONPacker(ioutil.Discard)
	rdr, err := NewInputTarStream(pR, nilPacker, nil)
	if err != nil {
		t.Fatal(err)
	}
	_, err = io.Copy(ioutil.Discard, rdr)
	if err != nil {
		t.Fatal(err)
	}
}
This test failing causes the binary to crash due to memory overcommitment.
package asm
import (
	"archive/tar"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"testing"
	"github.com/vbatts/tar-split/tar/storage"
)