tiff: limit PackBits decompression output size#29
Conversation
|
This PR (HEAD: 7ff5fd3) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/image/+/759960. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/759960. |
The unpackBits function has no output size limit, unlike readBuf which is used for LZW, Deflate, and CCITT compression. This allows a small crafted TIFF (2MB) to decompress to 745MB (372x amplification). The CVE-2023-29408 fix added decompression limits via readBuf for other compression formats but did not apply the same limit to PackBits. Add a limit parameter to unpackBits matching the blockMaxDataSize limit used by readBuf for other compression formats. Updates golang/go#61582 Change-Id: I659f1da32bd415e4cf15a6061cb9ceee7a45f2af
7ff5fd3 to
460db42
Compare
|
This PR (HEAD: 460db42) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/image/+/759960. Important tips:
|
|
Message from Mohammad Seet: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/759960. |
|
This PR (HEAD: 2e5fbdb) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/image/+/759960. Important tips:
|
|
Message from Mohammad Seet: Patch Set 3: Done. Removed duplicated title from body and ensured clean formatting. Please don’t reply on this GitHub thread. Visit golang.org/cl/759960. |
|
Message from Nigel Tao: Patch Set 4: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/759960. |
unpackBits has no output size limit. readBuf, which is used
for LZW, Deflate, and CCITT decompression, enforces a limit,
but the PackBits path bypasses readBuf entirely. This allows
a 2MB TIFF with PackBits compression to decompress to 745MB
(372x amplification).
CVE-2023-29408 added decompression size limits for other
formats but did not cover PackBits. This change adds a limit
parameter to unpackBits matching blockMaxDataSize, consistent
with the existing readBuf approach.
Updates golang/go#61582