| 1 |
Changes in TIFF v4.0.10 |
| 2 |
======================= |
| 3 |
|
| 4 |
.. table:: References |
| 5 |
:widths: auto |
| 6 |
|
| 7 |
====================== ========================================== |
| 8 |
Current Version v4.0.10 (:tag:`v4.0.10`) |
| 9 |
Previous Version :doc:`v4.0.9 <v4.0.9>` |
| 10 |
Master Download Site `<https://download.osgeo.org/libtiff/>`_ |
| 11 |
Master HTTP Site #1 `<http://www.simplesystems.org/libtiff/>`_ |
| 12 |
Master HTTP Site #2 `<http://libtiff.maptools.org/>`_ |
| 13 |
====================== ========================================== |
| 14 |
|
| 15 |
|
| 16 |
This document describes the changes made to the software between the |
| 17 |
*previous* and *current* versions (see above). If you don't |
| 18 |
find something listed here, then it was not done in this timeframe, or |
| 19 |
it was not considered important enough to be mentioned. The following |
| 20 |
information is located here: |
| 21 |
|
| 22 |
|
| 23 |
Major changes |
| 24 |
------------- |
| 25 |
|
| 26 |
* The libtiff source repository is changed from CVS to Git and the master libtiff source repository is now at |
| 27 |
`Gitlab <https://gitlab.com/libtiff/libtiff>`_. |
| 28 |
This is the first release to be made from the new Git repository. |
| 29 |
|
| 30 |
|
| 31 |
Software configuration changes |
| 32 |
------------------------------ |
| 33 |
|
| 34 |
* Minimum CMake version is now v2.8.11 for the CMake-based build. |
| 35 |
|
| 36 |
* Libwebp will be automatically detected and used by configure/cmake if present. |
| 37 |
|
| 38 |
* Libzstd will be automatically detected and used by configure/cmake if present. |
| 39 |
|
| 40 |
|
| 41 |
Library changes |
| 42 |
--------------- |
| 43 |
|
| 44 |
* Added ZSTD compression codec. |
| 45 |
`Zstandard <https://github.com/facebook/zstd>`_ or zstd as |
| 46 |
short version, is a fast lossless compression algorithm, targeting |
| 47 |
real-time compression scenarios at zlib-level and better |
| 48 |
compression ratios. It's backed by a very fast entropy stage, |
| 49 |
provided by Huff0 and FSE library. |
| 50 |
|
| 51 |
We require libzstd >= 1.0.0 so as to be able to use streaming |
| 52 |
compression and decompression methods. |
| 53 |
|
| 54 |
The default compression level we have selected is 9 (range goes |
| 55 |
from 1 to 22), which experimentally offers equivalent or better |
| 56 |
compression ratio than the default deflate/ZIP level of 6, and |
| 57 |
much faster compression. |
| 58 |
|
| 59 |
For example on a 6600×4400 16bit image, ``tiffcp -c zip`` runs in |
| 60 |
10.7 seconds, while ``tiffcp -c zstd`` runs in 5.3 |
| 61 |
seconds. Decompression time for zip is 840 ms, and for zstd 650 |
| 62 |
ms. File size is 42735936 for zip, and 42586822 for zstd. Similar |
| 63 |
findings on other images. |
| 64 |
|
| 65 |
On a 25894×16701 16bit image: |
| 66 |
|
| 67 |
.. table:: Compressor Relative Performance |
| 68 |
:widths: auto |
| 69 |
|
| 70 |
=========== ================ ================== =========== |
| 71 |
Compressor Compression time Decompression time File size |
| 72 |
=========== ================ ================== =========== |
| 73 |
ZSTD 35 s 3.2 s 399,700,498 |
| 74 |
ZIP/Deflate 1m 20 s 4.9 s 419,622,336 |
| 75 |
=========== ================ ================== =========== |
| 76 |
|
| 77 |
Please note that ``COMPRESSION_ZSTD`` is self-assigned the id 50000 |
| 78 |
by the libtiff project and is not officially registered with Adobe |
| 79 |
since Adobe's registration function is defunct. |
| 80 |
|
| 81 |
* Added WebP compression codec. |
| 82 |
|
| 83 |
`WebP <https://developers.google.com/speed/webp/>`_ is |
| 84 |
a high performance compressor intended for photos as commonly used |
| 85 |
on the Web. The WebP encoder is not designed for huge images, but |
| 86 |
serves very well for compressing strips and tiles in TIFF as long |
| 87 |
as the strips or tiles do not exceed the capability of the |
| 88 |
encoder. |
| 89 |
|
| 90 |
As a test of compression performance metrics, GraphicsMagick |
| 91 |
was used on an extremely high quality 8-bit TIFF image from a |
| 92 |
Hasselblad H4D-200MS camera with pixel dimensions of |
| 93 |
16352×12264. The image was re-encoded with 1024×1024 tiles and |
| 94 |
various compression algorithms, using default settings for each |
| 95 |
algorithm. Based on this test, the compression and decompression |
| 96 |
performance (in iterations per second), the resulting file size, |
| 97 |
and the calculated total PSNR are provided here. It can be seen |
| 98 |
that WebP provided excellent encode and decode performance, and |
| 99 |
the compressed file size was very small: |
| 100 |
|
| 101 |
|
| 102 |
.. table:: Compressor Relative Performance |
| 103 |
:widths: auto |
| 104 |
|
| 105 |
========== ============ ============= ========= ===== |
| 106 |
Compressor Compression Decompression File size PSNR |
| 107 |
========== ============ ============= ========= ===== |
| 108 |
None 0.536 iter/s 1.506 iter/s 576.03MiB ∞ |
| 109 |
LZW 0.105 iter/s 0.266 iter/s 270.68MiB ∞ |
| 110 |
ZStd 0.020 iter/s 0.518 iter/s 238.42MiB ∞ |
| 111 |
LZMA 0.009 iter/s 0.056 iter/s 247.61MiB ∞ |
| 112 |
ZIP 0.009 iter/s 0.301 iter/s 247.88MiB ∞ |
| 113 |
JPEG 0.446 iter/s 0.760 iter/s 18.59MiB 39.00 |
| 114 |
WebP 0.019 iter/s 0.330 iter/s 9.38MiB 37.78 |
| 115 |
========== ============ ============= ========= ===== |
| 116 |
|
| 117 |
Please note that ``COMPRESSION_WEBP`` is self-assigned the id 50001 |
| 118 |
by the libtiff project and is not officially registered with Adobe |
| 119 |
since Adobe's registration function is defunct. |
| 120 |
|
| 121 |
* :c:func:`TIFFPrintDirectory`: fix null pointer dereference on corrupted |
| 122 |
file. Fixes :bugzilla:`Bug 2770 - NULL Pointer Dereference in tiffinfo.c with crafted TIFF |
| 123 |
image <2770>`. |
| 124 |
|
| 125 |
* :c:func:`_TIFFVGetField`: fix heap out-of-bounds access when requesting |
| 126 |
``TIFFTAG_NUMBEROFINKS`` on a EXIF |
| 127 |
directory. Fixes :bugzilla:`Bug 2765 - Heap Out-Of-Bounds Memory Access - 68122422 |
| 128 |
<2765>`. |
| 129 |
Reported by Google Autofuzz project. |
| 130 |
|
| 131 |
* Fix a memory leak in :c:func:`TIFFStreamOpen`. :c:func:`TIFFStreamOpen` allocates a |
| 132 |
new ``tiff{o,i}s_data``, but if :c:func:`TIFFClientOpen` fails then that struct is |
| 133 |
leaked. |
| 134 |
|
| 135 |
* Fix for bug 2772. It is possible to craft a TIFF document where |
| 136 |
the IFD list is circular, leading to an infinite loop while |
| 137 |
traversing the chain. The libtiff directory reader has a failsafe |
| 138 |
that will break out of this loop after reading 65535 directory |
| 139 |
entries, but it will continue processing, consuming time and |
| 140 |
resources to process what is essentially a bogus TIFFdocument. |
| 141 |
|
| 142 |
This change fixes the above behavior by breaking out of processing |
| 143 |
when a TIFF document has >= 65535 directories and terminating with an |
| 144 |
error. |
| 145 |
|
| 146 |
* :c:func:`ChopUpSingleUncompressedStrip`: avoid memory exhaustion |
| 147 |
(:cve:`2017-11613`). In :c:func:`ChopUpSingleUncompressedStrip`, if the |
| 148 |
computed number of strips is big enough and we are in read only |
| 149 |
mode, validate that the file size is consistent with that number of |
| 150 |
strips to avoid useless attempts at allocating a lot of memory for |
| 151 |
the :c:member:`td_stripbytecount` and :c:member:`td_stripoffset` |
| 152 |
arrays. Fixes :bugzilla:`Bug 2724 - memory exhaustion in ChopUpSingleUncompressedStrip |
| 153 |
<2724>`. |
| 154 |
|
| 155 |
* Port code: Add :c:func:`strtol`, :c:func:`strtoll` and :c:func:`strtoull`. Also update |
| 156 |
:c:func:`strtoul`. All use the same implementation from NetBSD libc. |
| 157 |
|
| 158 |
* Fix for :cve:`2018-7456` "NULL pointer dereference in |
| 159 |
:c:func:`TIFFPrintDirectory`". |
| 160 |
|
| 161 |
* :c:func:`TIFFWriteDirectorySec`: avoid |
| 162 |
assertion. Fixes :bugzilla:`Bug 2795 - There is a reachable assertion abort in function |
| 163 |
TIFFWriteDirectorySec() of libtiff 4.0.9. A crafted input will lead |
| 164 |
to remote denial of attack. (:cve:`2018-10963`) |
| 165 |
<2795>`. |
| 166 |
|
| 167 |
* :c:func:`LZWDecodeCompat`: fix potential index-out-of-bounds |
| 168 |
write. Fixes :bugzilla:`Bug |
| 169 |
2780 - A heap-buffer-overflow in function LZWDecodeCompat in |
| 170 |
libtiff4.0.9 (:cve:`2018-8905`) |
| 171 |
<2780>`. |
| 172 |
The fix consists in using the |
| 173 |
similar code as :c:func:`LZWDecode` to validate we don't write outside of |
| 174 |
the output buffer. |
| 175 |
|
| 176 |
* Remove builtin support for GUI warning and error message |
| 177 |
boxes. Now warnings always go to the console by default unless |
| 178 |
applications define their own warning and error handlers. |
| 179 |
|
| 180 |
GUI applications (and Windows CE) are required to define such handlers. |
| 181 |
|
| 182 |
* Add tag and pseudo-tag definitions for ESRI LERC codec (out of |
| 183 |
tree codec whose source is |
| 184 |
at `<https://github.com/OSGeo/gdal/blob/master/gdal/frmts/gtiff/tif_lerc.c>`_. |
| 185 |
|
| 186 |
* Fix libtiff 4.0.8 regression when reading LZW-compressed strips with scanline API |
| 187 |
Fixes :bugzilla:`Bug 2800 - Regression: Opening a tiff file with v4.0.9 gives an error with LZWDecode |
| 188 |
<2800>`. |
| 189 |
|
| 190 |
* :c:func:`TIFFSetupStrips`: avoid potential :c:type:`uint32` overflow on 32-bit |
| 191 |
systems with large number of strips. Probably relates |
| 192 |
to :bugzilla:`Bug |
| 193 |
2788 - Heap Buffer Overflow in TIFFWriteScanline of tif_write.c |
| 194 |
(:cve:`2018-10779`) |
| 195 |
<2788>`. |
| 196 |
|
| 197 |
* Fix out-of-bound read on some tiled images. |
| 198 |
|
| 199 |
* Avoid potential :c:type:`int32` overflows in :c:func:`multiply_ms`. |
| 200 |
|
| 201 |
* Only read/write ``TIFFTAG_GROUP3OPTIONS`` or ``TIFFTAG_GROUP4OPTIONS`` |
| 202 |
if compression is ``COMPRESSION_CCITTFAX3`` or |
| 203 |
``COMPRESSION_CCITTFAX4``. |
| 204 |
|
| 205 |
* JBIG: fix potential out-of-bounds write in :c:func:`JBIGDecode`. Also |
| 206 |
fix a (harmless) potential use of uninitialized memory when |
| 207 |
``tif->tif_rawsize > tif->tif_rawcc``. In case libtiff is compiled with |
| 208 |
``CHUNKY_STRIP_READ_SUPPORT``, make sure that whole strip data is |
| 209 |
provided to :c:func:`JBIGDecode`. |
| 210 |
|
| 211 |
* :c:func:`LZMAPreEncode`: emit verbose error if :c:func:`lzma_stream_encoder` fails |
| 212 |
(typically because not enough memory available) |
| 213 |
|
| 214 |
|
| 215 |
Tools changes |
| 216 |
------------- |
| 217 |
|
| 218 |
* :program:`tiff2pdf`: Fix |
| 219 |
:cve:`2017-9935`, :bugzilla:`Bug |
| 220 |
2704 - There is a heap based buffer overflow in the tiff2pdf tool of |
| 221 |
the libtiff library. A crafted TIFF document can lead to a heap |
| 222 |
based buffer overflow resulting in multiple damages. |
| 223 |
<2704>`. |
| 224 |
|
| 225 |
* :program:`pal2rgb`: Add workaround to pal2rgb buffer overflow. |
| 226 |
|
| 227 |
* :program:`tiffset`: Add support for :c:macro:`LONG8`, :c:macro:`SLONG8` and :c:macro:`IFD8` field types |
| 228 |
|
| 229 |
* :program:`tiff2bw`: avoid null pointer dereference in case of out of memory |
| 230 |
situation. Fixes :bugzilla:`Bug |
| 231 |
2819 - There is a NULL pointer dereference at function LZWDecode in |
| 232 |
libtiff 4.0.9 (:cve:`2018-18661`) |
| 233 |
<2819>`. |
| 234 |
|
| 235 |
|
| 236 |
Contributed software changes |
| 237 |
---------------------------- |
| 238 |
|
| 239 |
None |