Changes in TIFF v4.0.9¶
Current Version |
v4.0.9 (tag Release-v4-0-9) |
Previous Version |
|
Master Download Site |
|
Master HTTP Site #1 |
|
Master HTTP Site #2 |
This document describes the changes made to the software between the previous and current versions (see above). If you don't find something listed here, then it was not done in this timeframe, or it was not considered important enough to be mentioned. The following information is located here:
Major changes¶
None
Software configuration changes¶
test/Makefile.am
: Add some tests for tiff2bw..appveyor.yml
,.travis.yml
,build/travis-ci
: apply patches0001-ci-Travis-script-improvements.patch
and0002-ci-Invoke-helper-script-via-shell.patch
by Roger Leigh (sent to mailing list).travis.yml
,build/travis-ci
: new files from0001-ci-Add-Travis-support-for-Linux-builds-with-Autoconf.patch
by Roger Leigh (sent to mailing list on 2017-06-08). This patch adds support for the Travis-CI service..appveyor.yml
: new file from0002-ci-Add-AppVeyor-support.patch
by Roger Leigh (sent to mailing list on 2017-06-08). This patch adds a.appveyor.yml
file to the top-level. This allows one to opt in to having a branch built on Windows with Cygwin, MinGW and MSVC automatically when a branch is pushed to GitHub, GitLab, BitBucket or any other supported git hosting service.CMakeLists.txt
,test/CMakeLists.txt
,test/TiffTestCommon.cmake
: apply patch0001-cmake-Improve-Cygwin-and-MingGW-test-support.patch
from Roger Leigh (sent to mailing list on 2017-06-08). This patch makes the CMake build system support running the tests with MinGW or Cygwin.test/tiffcp-lzw-compat.sh
,test/images/quad-lzw-compat.tiff
: new files to test old-style LZW decompressiontest/common.sh
,Makefile.am
,CMakeList.txt
: updated with abovetest/Makefile.am
: add missing reference to images/quad-lzw-compat.tiff to fixmake distcheck
. Patch by Roger Leighnmake.opt
: support aDEBUG=1
option, so as to adjustOPTFLAGS
and use/MDd
runtime in debug mode.
Library changes¶
libtiff/tif_color.c
:TIFFYCbCrToRGBInit()
: stricter clamping to avoidint32
overflow inTIFFYCbCrtoRGB()
. Fixes OSS-Fuzz #1844. Credit to OSS Fuzzlibtiff/tif_getimage.c
:initYCbCrConversion()
: stricter validation forrefBlackWhite
coefficients values. To avoid invalidfloat->int32
conversion (whenrefBlackWhite[0] == 2147483648.f
) Fixes OSS-Fuzz #1907. Credit to OSS Fuzzlibtiff/tif_dirinfo.c
,tif_dirread.c
: add_TIFFCheckFieldIsValidForCodec()
, and use it inTIFFReadDirectory()
so as to ignore fields whose tag is a codec-specified tag but this codec is not enabled. This avoidsTIFFGetField()
to behave differently depending on whether the codec is enabled or not, and thus can avoid stack based buffer overflows in a number of TIFF utilities such as tiffsplit, tiffcmp, thumbnail, etc. Patch derived from0063-Handle-properly-CODEC-specific-tags.patch
(MapTools bugzilla #2580) by Raphaël Hertzog. Fixes: MapTools bugzilla #2580, MapTools bugzilla #2693, MapTools bugzilla #2625 (CVE-2016-10095), MapTools bugzilla #2564 (CVE-2015-7554), MapTools bugzilla #2561 (CVE-2016-5318), MapTools bugzilla #2499 (CVE-2014-8128), MapTools bugzilla #2441, MapTools bugzilla #2433.libtiff/tif_swab.c
: ifDISABLE_CHECK_TIFFSWABMACROS
is defined, do not do the#ifdef TIFFSwabXXX
checks. Make it easier for GDAL to rename the symbols of its internal libtiff copy.libtiff/tif_dirread.c
: fix regression of libtiff 4.0.8 inChopUpSingleUncompressedStrip()
regarding update of newly single-strip uncompressed files whose bytecount is 0. Before the change of 2016-12-03, the conditionbytecount==0
used to trigger an early exit/disabling of strip chop. Re-introduce that in update mode. Otherwise this cause later incorrect setting for the value ofStripByteCounts
/StripOffsets
. (GDAL trac #6924).libtiff/tif_dirread.c
:TIFFFetchStripThing()
: limit the number of items read inStripOffsets
/StripByteCounts
tags to the number of strips to avoid excessive memory allocation. Fixes OSS-Fuzz #2215. Credit to OSS Fuzzlibtiff/tif_getimage.c
: avoid many (harmless) unsigned int overflows.libtiff/tif_fax3.c
: avoid unsigned int overflow inFax3Encode2DRow()
. Could potentially be a bug with huge rows.libtiff/tif_jpeg.c
: avoid (harmless) unsigned int overflow on tiled images.libtiff/tif_dirread.c
: avoid unsigned int overflow inEstimateStripByteCounts()
andBYTECOUNTLOOKSBAD
when file is too short.libtiff/tif_predict.c
: decorate legitimate functions where unsigned int overflow occur withTIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
libtiff/tif_dirread.c
: avoid unsigned int overflow inEstimateStripByteCounts()
libtiff/tiffiop.h
: addTIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
macro to disable CLang warnings raised by-fsanitize=undefined,unsigned-integer-overflow
libtiff/tif_jpeg.c
: add anti-denial of service measure to avoid excessive CPU consumption on progressive JPEGs with a huge number of scans. See http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf.Note
Only affects libtiff since 2014-12-29 where support of non-baseline JPEG was added.
libtiff/tif_jpeg.c
: error out at decoding time if anticipated libjpeg memory allocation is above 100 MB. libjpeg in case of multiple scans, which is allowed even in baseline JPEG, if components are spread over several scans and not interleavedin a single one, needs to allocate memory (or backing store) for the whole strip/tile. See http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf. This limitation may be overridden by setting theLIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC
environment variable, or recompiling libtiff with a custom value ofTIFF_LIBJPEG_LARGEST_MEM_ALLOC
macro.libtiff/tif_jbig.c
: fix memory leak in error code path ofJBIGDecode()
. Fixes MapTools bugzilla #2706. Reported by team OWL337libtiff/tif_dirread.c
: inTIFFReadDirEntryFloat()
, check that a double value can fit in a float before casting. Patch by Nicolas RUFFlibtiff/tiffiop.h
,libtiff/tif_jpeg.c
,libtiff/tif_jpeg_12.c
,libtiff/tif_read.c
: makeTIFFReadScanline()
works inCHUNKY_STRIP_READ_SUPPORT
mode with JPEG stream with multiple scans. Also make configurable through aLIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER
environment variable the maximum number of scans allowed. Defaults to 100.libtiff/tif_read.c
:TIFFFillTile()
: add limitation to the number of bytes read in case td_stripbytecount[strip] is bigger than reasonable, so as to avoid excessive memory allocation (similarly to what was done forTIFFFileStrip()
on 2017-05-10)libtiff/tif_getimage.c
: use_TIFFReadEncodedStripAndAllocBuffer()
. Fixes MapTools bugzilla #2708 and OSS-Fuzz #2433. Credit to OSS Fuzzlibtiff/tif_read.c
, tiffiop.h: add a_TIFFReadEncodedStripAndAllocBuffer()
function, variant ofTIFFReadEncodedStrip()
that allocates the decoded buffer only after a first successfulTIFFFillStrip()
. This avoids excessive memory allocation on corrupted files.libtiff/tif_dirwrite.c
: inTIFFWriteDirectoryTagCheckedXXXX()
functions associated with LONG8/SLONG8 data type, replace assertion that the file is BigTIFF, by a non-fatal error. Fixes MapTools bugzilla #2712 Reported by team OWL337libtiff/tif_read.c
:TIFFStartTile()
: set tif_rawcc to tif_rawdataloaded when it is set. Similarly toTIFFStartStrip()
. This issue was revealed by the change of 2017-06-30 inTIFFFileTile()
, limiting the number of bytes read. But it could probably have been hit too in CHUNKY_STRIP_READ_SUPPORT mode previously ? Fixes OSS-Fuzz #2454 Credit to OSS Fuzzlibtiff/tif_error.c, tif_warning.c
: correctly use va_list when both an old-style and new-style warning/error handlers are installed. Patch by Paavo Helde (sent on the mailing list)libtiff/tif_getimage.c
: use_TIFFReadTileAndAllocBuffer()
. Fixes OSS-Fuzz #2470 Credit to OSS Fuzz.libtiff/tif_read.c
, tiffiop.h: add a_TIFFReadEncodedTileAndAllocBuffer()
and_TIFFReadTileAndAllocBuffer()
variants ofTIFFReadEncodedTile()
andTIFFReadTile()
that allocates the decoded buffer only after a first successfulTIFFFillTile()
. This avoids excessive memory allocation on corrupted files.libtiff/tif_pixarlog.c
: avoid excessive memory allocation on decoding when RowsPerStrip tag is not defined (and thus td_rowsperstrip == UINT_MAX) Fixes OSS-Fuzz #2554 Credit to OSS Fuzzlibtiff/tif_lzw.c
: fix 4.0.8 regression in the decoding of old-style LZW compressed files.libtiff/tif_lzw.c
: fix potential out-of-buffer read on 1-byte LZW strips. Crashing issue only on memory mapped files, where the strip offset is the last byte of the file, and the file size is a multiple of one page size on the CPU architecture (typically 4096). Credit to myself :-)libtiff/tif_dir.c
: avoid potential null pointer dereference in_TIFFVGetField()
on corrupted TIFFTAG_NUMBEROFINKS tag instance. Fixes MapTools bugzilla #2713tools/tiff2pdf.c
: prevent heap buffer overflow write in "Raw" mode onPlanarConfig=Contig
input images. Fixes MapTools bugzilla #2715 Reported by team OWL337libtiff/tif_read.c
:TIFFFillStrip()
/TIFFFillTile()
. Complementary fix for MapTools bugzilla #2708 in theisMapped()
case, so as to avoid excessive memory allocation when we need a temporary buffer but the file is truncated.libtiff/tif_read.c
:TIFFFillStrip()
/TIFFFillTile()
. Complementary fix for MapTools bugzilla #2708 in theisMapped()
case, so as to avoid excessive memory allocation when we need a temporary buffer but the file is truncated.libtiff/tif_read.c
: inTIFFFetchStripThing()
, only grow the arrays that hold StripOffsets/StripByteCounts, when they are smaller than the expected number of striles, up to 1 million striles, and error out beyond. Can be tweaked by setting the environment variableLIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT
. This partially goes against a change added on 2002-12-17 to accept those arrays of wrong sizes, but is needed to avoid denial of services. Fixes OSS-Fuzz #2350 Credit to OSS Fuzzlibtiff/tif_read.c
: inTIFFFetchStripThing()
, only grow the arrays that holdStripOffsets
/StripByteCounts
, when they are smaller than the expected number of striles, up to 1 million striles, and error out beyond. Can be tweaked by setting the environment variableLIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT
. This partially goes against a change added on 2002-12-17 to accept those arrays of wrong sizes, but is needed to avoid denial of services. Fixes OSS-Fuzz #2350 Credit to OSS Fuzzlibtiff/tif_read.c
: add protection against excessive memory allocation attempts inTIFFReadDirEntryArray()
on short files. Effective for mmap'ed case. And non-mmap'ed case, but restricted to 64bit builds. Fixes MapTools bugzilla #2675libtiff/tif_read.c
: add protection against excessive memory allocation attempts inTIFFReadDirEntryArray()
on short files. Effective for mmap'ed case. And non-mmap'ed case, but restricted to 64bit builds. Fixes MapTools bugzilla #2675libtiff/tif_luv.c
:LogLuvInitState()
: avoid excessive memory allocation whenRowsPerStrip
tag is missing. Fixes OSS-Fuzz #2683 Credit to OSS-Fuzzlibtiff/tif_getimage.c
:gtTileContig()
andgtTileSeparate()
: properly break from loops on error whenstoponerr
is set, instead of going on iterating on row based loop.libtiff/tif_getimage.c
: fix fromskew computation when to-be-skipped pixel number is not a multiple of the horizontal subsampling, and also in some other cases. Impactputcontig8bitYCbCr44tile
,putcontig8bitYCbCr42tile
,putcontig8bitYCbCr41tile
,putcontig8bitYCbCr21tile
andputcontig8bitYCbCr12tile
. Fixes MapTools bugzilla #2637 (discovered by Agostino Sarubbo) and OSS-Fuzz #2691 (credit to OSS Fuzz)libtiff/tif_luv.c
: further reduce memory requirements for temporary buffer whenRowsPerStrip >= image_length
inLogLuvInitState()
andLogL16InitState()
. Fixes OSS-Fuzz #2700 Credit to OSS Fuzzlibtiff/tif_dirwrite.c
: replace assertion related to not finding theSubIFD
tag by runtime check (inTIFFWriteDirectorySec()
) Fixes MapTools bugzilla #2727 Reported by team OWL337libtiff/tif_dirwrite.c
: replace assertion to tag value not fitting onuint32
when selecting the value ofSubIFD
tag by runtime check (inTIFFWriteDirectoryTagSubifd()
). Fixes MapTools bugzilla #2728 Reported by team OWL337libtiff/tif_jpeg.c
: accept reading the last strip of a JPEG compressed file if the codestream height is larger than the truncated height of the strip. Emit a warning in this situation since this is non compliant.libtiff/tiffiop.h
,tif_aux.c
: redirectSeekOK()
macro to a_TIFFSeekoK()
function that checks if the offset is not bigger thanINT64_MAX
, so as to avoid a-1
error return code ofTIFFSeekFile()
to match a required seek toUINT64_MAX
/-1
. Fixes MapTools bugzilla #2726 Adapted from proposal by Nicolas Ruff.libtiff/tif_dirread.c
: addNULL
check to avoid likely false positive null-pointer dereference warning by CLang Static Analyzer.libtiff/libtiff.def
: addTIFFReadRGBAStripExt()
andTIFFReadRGBATileExt()
Fixes MapTools bugzilla #2735libtiff/tif_jpeg.c
: add compatibility with libjpeg-turbo 1.5.2 that honoursmax_memory_to_use > 0
. Cf https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162.libtiff/tif_getimage.c
: avoid floating point division by zero ininitCIELabConversion()
Fixes OSS-Fuzz #3733 Credit to OSS Fuzz
Tools changes¶
tools/tiff2pdf.c
: prevent heap buffer overflow write in "Raw" mode onPlanarConfig=Contig
input images. Fixes MapTools bugzilla #2715 Reported by team OWL337tools/tiffset.c
: fix setting a single value for theExtraSamples
tag (and other tags with variable number of values). Sotiffset -s ExtraSamples 1 X
. This only worked when setting 2 or more values, but not just one.tools/fax2tiff.c
(_FAX_Client_Data
): PassFAX_Client_Data
as the client data. This client data is not used at all at the moment, but it makes the most sense. Issue that the value ofclient_data.fd
was passed where a pointer is expected was reported via email by Gerald Schade on Sun, 29 Oct 2017.tools/tiff2pdf.c
(t2p_sample_realize_palette
): Fix possible arithmetic overflow in bounds checking code and eliminate comparison between signed and unsigned type.tools/tiff2bw.c
(main()
): Free memory allocated in the tiff2bw program. This is in response to the report associated with CVE-2017-16232 but does not solve the extremely high memory usage with the associated POC file.
Contributed software changes¶
None