(file *zip.File)
| 73 | } |
| 74 | |
| 75 | func projectedTarEntrySize(file *zip.File) (uint64, error) { |
| 76 | // Each tar entry contributes one header block plus its data |
| 77 | // rounded up to the next tar block boundary. |
| 78 | size := file.UncompressedSize64 |
| 79 | if remainder := size % tarBlockSize; remainder != 0 { |
| 80 | padding := tarBlockSize - remainder |
| 81 | if size > math.MaxUint64-padding { |
| 82 | return 0, ErrArchiveTooLarge |
| 83 | } |
| 84 | size += padding |
| 85 | } |
| 86 | |
| 87 | if size > math.MaxUint64-tarBlockSize { |
| 88 | return 0, ErrArchiveTooLarge |
| 89 | } |
| 90 | |
| 91 | return tarBlockSize + size, nil |
| 92 | } |
| 93 | |
| 94 | type limitedWriter struct { |
| 95 | w io.Writer |
no outgoing calls
no test coverage detected