go/src/archive/zip/reader_test.go

type ZipTest

type ZipTestFile

var tests

func TestReader(t *testing.T) {}

func readTestZip(t *testing.T, zt ZipTest) {}

func equalTimeAndZone(t1, t2 time.Time) bool {}

func readTestFile(t *testing.T, zt ZipTest, ft ZipTestFile, f *File, raw []byte) {}

func testFileMode(t *testing.T, f *File, want fs.FileMode) {}

func TestInvalidFiles(t *testing.T) {}

func messWith(fileName string, corrupter func(b []byte)) (r io.ReaderAt, size int64) {}

func returnCorruptCRC32Zip() (r io.ReaderAt, size int64) {}

func returnCorruptNotStreamedZip() (r io.ReaderAt, size int64) {}

// rZipBytes returns the bytes of a recursive zip file, without
// putting it on disk and triggering certain virus scanners.
func rZipBytes() []byte {}

func returnRecursiveZip() (r io.ReaderAt, size int64) {}

// biggestZipBytes returns the bytes of a zip file biggest.zip
// that contains a zip file bigger.zip that contains a zip file
// big.zip that contains big.file, which contains 2³²-1 zeros.
// The big.zip file is interesting because it has no zip64 header,
// much like the innermost zip files in the well-known 42.zip.
//
// biggest.zip was generated by changing isZip64 to use > uint32max
// instead of >= uint32max and then running this program:
//
//	package main
//
//	import (
//		"archive/zip"
//		"bytes"
//		"io"
//		"log"
//		"os"
//	)
//
//	type zeros struct{}
//
//	func (zeros) Read(b []byte) (int, error) {
//		clear(b)
//		return len(b), nil
//	}
//
//	func main() {
//		bigZip := makeZip("big.file", io.LimitReader(zeros{}, 1<<32-1))
//		if err := os.WriteFile("/tmp/big.zip", bigZip, 0666); err != nil {
//			log.Fatal(err)
//		}
//
//		biggerZip := makeZip("big.zip", bytes.NewReader(bigZip))
//		if err := os.WriteFile("/tmp/bigger.zip", biggerZip, 0666); err != nil {
//			log.Fatal(err)
//		}
//
//		biggestZip := makeZip("bigger.zip", bytes.NewReader(biggerZip))
//		if err := os.WriteFile("/tmp/biggest.zip", biggestZip, 0666); err != nil {
//			log.Fatal(err)
//		}
//	}
//
//	func makeZip(name string, r io.Reader) []byte {
//		var buf bytes.Buffer
//		w := zip.NewWriter(&buf)
//		wf, err := w.Create(name)
//		if err != nil {
//			log.Fatal(err)
//		}
//		if _, err = io.Copy(wf, r); err != nil {
//			log.Fatal(err)
//		}
//		if err := w.Close(); err != nil {
//			log.Fatal(err)
//		}
//		return buf.Bytes()
//	}
//
// The 4 GB of zeros compresses to 4 MB, which compresses to 20 kB,
// which compresses to 1252 bytes (in the hex dump below).
//
// It's here in hex for the same reason as rZipBytes above: to avoid
// problems with on-disk virus scanners or other zip processors.
func biggestZipBytes() []byte {}

func returnBigZipBytes() (r io.ReaderAt, size int64) {}

func TestIssue8186(t *testing.T) {}

// Verify we return ErrUnexpectedEOF when length is short.
func TestIssue10957(t *testing.T) {}

// Verify that this particular malformed zip file is rejected.
func TestIssue10956(t *testing.T) {}

// Verify we return ErrUnexpectedEOF when reading truncated data descriptor.
func TestIssue11146(t *testing.T) {}

// Verify we do not treat non-zip64 archives as zip64
func TestIssue12449(t *testing.T) {}

func TestFS(t *testing.T) {}

func TestFSWalk(t *testing.T) {}

func TestFSModTime(t *testing.T) {}

func TestCVE202127919(t *testing.T) {}

func TestOpenReaderInsecurePath(t *testing.T) {}

func TestCVE202133196(t *testing.T) {}

func TestCVE202139293(t *testing.T) {}

func TestCVE202141772(t *testing.T) {}

func TestUnderSize(t *testing.T) {}

func TestIssue54801(t *testing.T) {}

func TestInsecurePaths(t *testing.T) {}

func TestDisableInsecurePathCheck(t *testing.T) {}

func TestCompressedDirectory(t *testing.T) {}

func TestBaseOffsetPlusOverflow(t *testing.T) {}