Change information
Commit message:
image, image/gif: document DecodeConfig before Decode for untrusted input
Document that image.Decode may allocate memory proportional to width and
height from the image header before all pixel data is consumed or validated,
and that image.DecodeConfig reads only headers without allocating a full
pixel buffer.
Add package-level and function-level notes on gif.Decode, gif.DecodeAll,
and gif.DecodeConfig pointing to the same guidance and the Security
Considerations section in package image.
Add ExampleDecode_untrusted in package image: call DecodeConfig, reject
oversized dimensions using an int64 pixel product, then Decode.
Updates #79063
Change-Id: I491fa036dab49f4d413e04df161da5f430f3cf97
GitHub-Last-Rev: 8effaee7164de82179f93c7bd5286da0910f4323
GitHub-Pull-Request: golang/go#79221
Files:
- M src/image/decode_example_test.go
- M src/image/format.go
- M src/image/gif/reader.go
Change size: M
Delta: 3 files changed, 73 insertions(+), 5 deletions(-)
Branch: refs/heads/master