A crafted 8-byte TIFF file with IFD offset 0xFFFFFFFF causes
buffer.fill() to allocate ~4GB of memory when decoding via
io.Reader (non-ReaderAt path), leading to an out-of-memory
crash in any Go application that calls Decode or DecodeConfig
on untrusted input.
Read the data, and allocate the buffer, in chunks,
to limit memory allocation to the size of the input file.
Fix: golang/image#25
References: https://issuetracker.google.com/issues/494365189
A crafted 8-byte TIFF file with IFD offset 0xFFFFFFFF causes
buffer.fill() to allocate ~4GB of memory when decoding via
io.Reader (non-ReaderAt path), leading to an out-of-memory
crash in any Go application that calls Decode or DecodeConfig
on untrusted input.
Read the data, and allocate the buffer, in chunks,
to limit memory allocation to the size of the input file.
Fix: golang/image#25
References: https://issuetracker.google.com/issues/494365189