tiff: limit the amount of data read in IFD entries The Image File Directory (IFD) of a TIFF contains a number of key/value pairs, where the values can be unboundedly large arrays of integers. We allocate slices to hold these arrays. Limit the size of IFD entries. For most entries, set an arbitrary, much-larger-than-needed limit of 16 values. For entries that scale to the size of the image, defer parsing the entry until we know the image size and then cap the size based on the image dimensions. This CL doesn't contain tests for the change, because there isn't an easy-to-observe effect of it. We match libTIFF's behvaior and truncate overly-large IFD entries rather than returning a parse error. The impact is that we allocate less memory. Change-Id: I7e5c17ae202551097b79220f96d262de6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/image/+/790221 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Neal Patel <neal@golang.org> Reviewed-by: Neal Patel <nealpatel@google.com> Auto-Submit: Damien Neil <dneil@google.com>
This repository holds supplementary Go image packages.
The packages in this repository have the same security model as the standard library image package. Specifically, when operating on arbitrary images, DecodeConfig should be called before Decode, so that the program can decide whether the image, as defined in the returned header, can be safely decoded with the available resources. A call to Decode which produces an extremely large image, as defined in the header returned by DecodeConfig, is not considered a security issue, regardless of whether the image is itself malformed or not.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.
The git repository is https://go.googlesource.com/image.
The main issue tracker for the image repository is located at https://go.dev/issues. Prefix your issue with “x/image:” in the subject line, so it is easy to find.