| 1 |
Changes in TIFF v4.0.4beta |
| 2 |
========================== |
| 3 |
|
| 4 |
.. table:: References |
| 5 |
:widths: auto |
| 6 |
|
| 7 |
====================== ========================================== |
| 8 |
Current Version v4.0.4beta (:tag:`Release-v4-0-4beta`) |
| 9 |
Previous Version :doc:`v4.0.3 <v4.0.3>` |
| 10 |
Master Download Site `<https://download.osgeo.org/libtiff/>`_ |
| 11 |
Master HTTP Site `<https://download.osgeo.org/libtiff/>`_ |
| 12 |
====================== ========================================== |
| 13 |
|
| 14 |
This document describes the changes made to the software between the |
| 15 |
*previous* and *current* versions (see above). If you don't |
| 16 |
find something listed here, then it was not done in this timeframe, or |
| 17 |
it was not considered important enough to be mentioned. The following |
| 18 |
information is located here: |
| 19 |
|
| 20 |
|
| 21 |
Major changes |
| 22 |
------------- |
| 23 |
* None |
| 24 |
|
| 25 |
|
| 26 |
Software configuration changes |
| 27 |
------------------------------ |
| 28 |
|
| 29 |
* Updated to use Automake 1.15 and Libtool 2.4.5 |
| 30 |
|
| 31 |
|
| 32 |
Library changes |
| 33 |
--------------- |
| 34 |
|
| 35 |
* :c:func:`TIFFCheckDirOffset`: avoid :c:type:`uint16` overflow |
| 36 |
when reading more than 65535 directories, and effectively error out when |
| 37 |
reaching that limit. |
| 38 |
|
| 39 |
* :c:func:`TIFFNumberOfDirectories`: generate error in case of directory count |
| 40 |
overflow. |
| 41 |
|
| 42 |
* :c:func:`TIFFAdvanceDirectory`: If nextdir is found to |
| 43 |
be defective, then set it to zero before returning error in order |
| 44 |
to terminate processing of truncated TIFF. |
| 45 |
|
| 46 |
* JPEG-in-TIFF: recognize ``SOF2``, ``SOF9`` and ``SOF10`` |
| 47 |
markers to avoid emitting a warning. Fix for compatibility with mozjpeg library. |
| 48 |
Note: the default settings of mozjpeg will produce progressive scans, which |
| 49 |
is forbidden by the TechNote. |
| 50 |
|
| 51 |
* JPEG-in-TIFF: Fix regression introduced in 3.9.3/4.0.0 that caused |
| 52 |
all tiles/strips to include quantization tables even when the jpegtablesmode |
| 53 |
had the :c:macro:`JPEGTABLESMODE_QUANT` bit set. |
| 54 |
Also add explicit removal of Huffman tables when jpegtablesmode has the |
| 55 |
:c:macro:`JPEGTABLESMODE_HUFF` bit set, which avoids Huffman tables to be emitted in the |
| 56 |
first tile/strip (only useful in update scenarios. create-only was |
| 57 |
fine) |
| 58 |
|
| 59 |
* JPEG-in-TIFF: fix segfault in :c:func:`JPEGFixupTagsSubsampling` on |
| 60 |
corrupted image where ``tif->tif_dir.td_stripoffset == NULL``. |
| 61 |
(:bugzilla:`2471`) |
| 62 |
|
| 63 |
* NeXT codec: add new tests to check that we don't read outside of |
| 64 |
the compressed input stream buffer. |
| 65 |
|
| 66 |
* NeXT codec: check that ``BitsPerSample`` = 2. Fixes |
| 67 |
:bugzilla:`2487` (:cve:`2014-8129`) |
| 68 |
|
| 69 |
* NeXT codec: in the "run mode", use tilewidth for tiled images |
| 70 |
instead of imagewidth to avoid crash |
| 71 |
|
| 72 |
* tif_getimage.c: in OJPEG case, fix checks on strile width/height |
| 73 |
in the ``putcontig8bitYCbCr42tile``, ``putcontig8bitYCbCr41tile`` and |
| 74 |
``putcontig8bitYCbCr21tile`` cases. |
| 75 |
|
| 76 |
* in :c:func:`TIFFDefaultDirectory`, reset any already existing |
| 77 |
extended tags installed by user code through the extender mechaninm before |
| 78 |
calling the extender callback (GDAL #5054) |
| 79 |
|
| 80 |
* Fix warnings about unused parameters. |
| 81 |
|
| 82 |
* Fix various typos in comments found by Debian lintian tool (GDAL #5756) |
| 83 |
|
| 84 |
* tif_getimage.c: avoid divide by zero on invalid YCbCr subsampling. |
| 85 |
(:bugzilla:`2235`) |
| 86 |
|
| 87 |
* :file:`tif_dirread.c`: In :c:func:`EstimateStripByteCounts`, check return code |
| 88 |
of :c:func:`_TIFFFillStriles`. This solves crashing bug on corrupted |
| 89 |
images generated by afl. |
| 90 |
|
| 91 |
* :file:`tif_read.c`: fix several invalid comparisons of a :c:type:`uint64` value with |
| 92 |
``<= 0`` by casting it to :c:type:`int64` first. This solves crashing bug on corrupted |
| 93 |
images generated by afl. |
| 94 |
|
| 95 |
* :c:func:`TIFFSetField`: refuse to set negative values for |
| 96 |
:c:macro:`TIFFTAG_XRESOLUTION` and :c:macro:`TIFFTAG_YRESOLUTION` that cause asserts when writing |
| 97 |
the directory |
| 98 |
|
| 99 |
* :c:func:`TIFFReadDirectory`: refuse to read ``ColorMap`` or |
| 100 |
``TransferFunction`` if ``BitsPerSample`` has not yet been read, otherwise reading |
| 101 |
it later will cause user code to crash if ``BitsPerSample > 1`` |
| 102 |
|
| 103 |
* :c:func:`TIFFRGBAImageOK`: return FALSE if LOGLUV with |
| 104 |
``SamplesPerPixel != 3``, or if CIELAB with |
| 105 |
``SamplesPerPixel != 3`` or ``BitsPerSample != 8`` |
| 106 |
|
| 107 |
* :file:`tif_config.vc.h`: no longer use ``#define snprintf _snprintf`` with |
| 108 |
Visual Studio 2015 aka VC 14 aka MSVC 1900 |
| 109 |
|
| 110 |
* LZW codec: prevent potential null dereference of ``sp->dec_codetab`` in :c:func:`LZWPreDecode` |
| 111 |
(:bugzilla:`2459`) |
| 112 |
|
| 113 |
* :c:func:`TIFFReadBufferSetup`: avoid passing -1 size |
| 114 |
to :c:func:`TIFFmalloc` if passed user buffer size is 0 |
| 115 |
(:bugzilla:`2459`) |
| 116 |
|
| 117 |
* :c:func:`TIFFReadDirEntryOutputErr`: Incorrect |
| 118 |
count for tag should be a warning rather than an error since |
| 119 |
errors terminate processing. |
| 120 |
|
| 121 |
* :file:`tif_dirinfo.c` (``TIFFField``) : Fix data type for :c:macro:`TIFFTAG_GLOBALPARAMETERSIFD` tag. |
| 122 |
|
| 123 |
* Add definitions for TIFF/EP ``CFARepeatPatternDim`` and ``CFAPattern`` tags |
| 124 |
(:bugzilla:`2457`) |
| 125 |
|
| 126 |
* :file:`tif_codec.c`, :file:`tif_dirinfo.c`: Enlarge some fixed-size buffers that weren't |
| 127 |
large enough, and eliminate substantially all uses of ``sprintf(buf, |
| 128 |
...)`` in favor of using ``snprintf(buf, sizeof(buf), ...)`` |
| 129 |
|
| 130 |
* :file:`configure.ac`: Improve pkg-config static linking by adding ``-lm`` to ``Libs.private`` when needed. |
| 131 |
|
| 132 |
* :file:`tif_write.c`: :c:type:`tmsize_t` related casting warning fixed for |
| 133 |
64bit linux. |
| 134 |
|
| 135 |
* :file:`tif_read.c`: :c:type:`uint64`/:c:type:`tmsize_t` change for MSVC warnings. |
| 136 |
(:bugzilla:`2427`) |
| 137 |
|
| 138 |
* Fix :c:func:`TIFFPrintDirectory` handling of |
| 139 |
:c:member:`field_passcount` fields: it had the :c:macro:`TIFF_VARIABLE` and |
| 140 |
:c:macro:`TIFF_VARIABLE2` cases backwards. |
| 141 |
|
| 142 |
* PixarLog codec: Improve previous patch for :cve:`2012-4447` |
| 143 |
(to enlarge :c:member:`tbuf` for possible partial stride at end) so that |
| 144 |
overflow in the integer addition is detected. |
| 145 |
|
| 146 |
* :file:`tif_{unix,vms,win32}.c` (:c:func:`_TIFFmalloc`): ANSI C does not |
| 147 |
require :c:func:`malloc` to return :c:macro:`NULL` pointer if requested allocation |
| 148 |
size is zero. Assure that :c:func:`_TIFFmalloc` does. |
| 149 |
|
| 150 |
* :file:`tif_zip.c`: Avoid crash on :c:macro:`NULL` error messages. |
| 151 |
|
| 152 |
|
| 153 |
Tools changes |
| 154 |
------------- |
| 155 |
* :program:`tiff2pdf` Fix various crashes and memory buffer access errors (oCERT-2014-013). |
| 156 |
* :program:`tiff2pdf` fix buffer overflow on some YCbCr JPEG compressed images. |
| 157 |
(:bugzilla:`2445`) |
| 158 |
* :program:`tiff2pdf` fix buffer overflow on YCbCr JPEG compressed image. |
| 159 |
(:bugzilla:`2443`) |
| 160 |
* :program:`tiff2pdf` check return code of :c:func:`TIFFGetField` when reading :c:macro:`TIFFTAG_SAMPLESPERPIXEL` |
| 161 |
* :program:`tiff2pdf` fix crash due to invalid tile count. |
| 162 |
* :program:`tiff2pdf` Detect invalid settings of ``BitsPerSample``/``SamplesPerPixel`` for CIELAB / ITULAB |
| 163 |
* :program:`tiff2pdf` Assure that memory size calculations for |
| 164 |
:c:func:`_TIFFmalloc` do not overflow the range of :c:type:`tmsize_t`. |
| 165 |
* :program:`tiff2pdf` Avoid crash when :c:macro:`TIFFTAG_TRANSFERFUNCTION` tag returns one channel, |
| 166 |
with the other two channels set to :c:macro:`NULL`. |
| 167 |
* :program:`tiff2pdf` close PDF file. (:bugzilla:`2479`) |
| 168 |
* :program:`tiff2pdf` Preserve input file directory order when pages |
| 169 |
are tagged with the same page number. |
| 170 |
* :program:`tiff2pdf.c` terminate after failure of allocating ycbcr buffer |
| 171 |
(:bugzilla:`2449`, :cve:`2013-4232`) |
| 172 |
* :program:`tiff2pdf` Rewrite JPEG marker parsing in |
| 173 |
:c:func:`t2p_process_jpeg_strip` to be at least marginally competent. The |
| 174 |
approach is still fundamentally flawed, but at least now it won't |
| 175 |
stomp all over memory when given bogus input. Fixes :cve:`2013-1960`. |
| 176 |
* :program:`tiffdump` Guard against arithmetic overflow when calculating allocation buffer sizes. |
| 177 |
* :program:`tiffdump` fix crash due to overflow of entry count. |
| 178 |
* :program:`tiffdump` Fix double-free bug. |
| 179 |
* :program:`tiffdump` detect cycle in TIFF directory chaining. |
| 180 |
(:bugzilla:`2463`) |
| 181 |
* :program:`tiffdump` avoid passing a :c:macro:`NULL` pointer to :c:func:`read` if :c:func:`seek` failed before. |
| 182 |
(:bugzilla:`2459`) |
| 183 |
* :program:`tiff2bw` when ``Photometric = RGB``, the utility only works if ``SamplesPerPixel = 3``. Enforce that. |
| 184 |
(:bugzilla:2485`, :cve:`2014-8127`) |
| 185 |
* :program:`pal2rgb`, :program:`thumbnail`: fix crash by disabling :c:macro:`TIFFTAG_INKNAMES` copying. |
| 186 |
(:bugzilla:`#2484`, :cve:`2014-8127`) |
| 187 |
* :program:`thumbnail` fix out-of-buffer write. |
| 188 |
(:bugzilla:`2489`, :cve:`2014-8128`) |
| 189 |
* :program:`thumbnail`, :program:`tiffcmp`: only read/write :c:macro:`TIFFTAG_GROUP3OPTIONS` |
| 190 |
or :c:macro:`TIFFTAG_GROUP4OPTIONS` if compression is :c:macro:`COMPRESSION_CCITTFAX3` or |
| 191 |
:c:macro:`COMPRESSION_CCITTFAX4`. |
| 192 |
(:bugzilla:`2493`, :cve:`2014-8128`) |
| 193 |
* :program:`tiffcp` fix crash when converting YCbCr JPEG-compressed to none. |
| 194 |
(:bugzilla:`2480`) |
| 195 |
* :program:`bmp2tiff` fix crash due to int overflow related to input BMP dimensions |
| 196 |
* :program:`tiffcrop` fix crash due to invalid ``TileWidth``/``TileHeight`` |
| 197 |
* :program:`tiffcrop` fix segfault if bad value passed to ``-Z`` option |
| 198 |
(:bugzilla:`2459`) and add missing ``va_end`` in :c:func:`dump_info` |
| 199 |
* :program:`thumbnail`, :program:`tiffcrop`: "fix" heap read over-run found with |
| 200 |
Valgrind and Address Sanitizer on test suite |
| 201 |
* :program:`fax2ps` check :c:func:`malloc`/:c:func:`realloc` result. (:bugzilla:`2470`) |
| 202 |
* :program:`gif2tiff` apply patch for :cve:`2013-4243`. (:bugzilla:`2451`) |
| 203 |
* :program:`gif2tiff` fix possible OOB write. (:bugzilla:`2452`, :cve:`2013-4244`) |
| 204 |
* :program:`gif2tiff` Be more careful about corrupt or hostile input files (:bugzilla:`2450`, :cve:`2013-4231`) |
| 205 |
* :program:`tiff2rgba` fix usage message in that zip was wrongly described |
| 206 |
* :program:`tiffinfo` Default various values fetched with :c:func:`TIFFGetField` to avoid being uninitialized. |
| 207 |
* :program:`tiff2ps` Fix bug in auto rotate option code. |
| 208 |
* :program:`ppm2tiff` avoid zero size buffer vulnerability (:cve:`2012-4564`). |
| 209 |
check the linebytes calculation too, get the :c:func:`max` calculation |
| 210 |
straight, avoid redundant error messages, check for :c:func:`malloc` |
| 211 |
failure. |
| 212 |
* :program:`tiffset` now supports a ``-u`` option to unset a tag. |
| 213 |
(:bugzilla:`2419`) |
| 214 |
* Fix warnings about unused parameters. |
| 215 |
* :program:`rgb2ycbcr`, :program:`tiff2bw`, :program:`tiff2pdf`, :program:`tiff2ps`, :program:`tiffcrop`, :program:`tiffdither`: |
| 216 |
Enlarge some fixed-size buffers that weren't |
| 217 |
large enough, and eliminate substantially all uses of ``sprintf(buf, |
| 218 |
...)`` in favor of using ``snprintf(buf, sizeof(buf), ...)``, so as to |
| 219 |
protect against overflow of fixed-size buffers. This responds in |
| 220 |
particular to :cve:`2013-1961` concerning overflow in :file:`tiff2pdf.c`'s |
| 221 |
:c:func:`t2p_write_pdf_page`. |
| 222 |
* :file:`html/man/tiff2ps.1.html`, :file:`html/man/tiffcp.1.html`, |
| 223 |
:file:`html/man/tiffdither.1.html`, :file:`man/tiff2ps.1`, :file:`man/tiffcp.1`, |
| 224 |
:file:`man/tiffdither.1`, :file:`tools/tiff2ps.c`, :file:`tools/tiffcp.c`, |
| 225 |
:file:`tools/tiffdither.c`: Sync tool usage printouts and man pages with |
| 226 |
reality |
| 227 |
|
| 228 |
|
| 229 |
Contributed software changes |
| 230 |
---------------------------- |
| 231 |
|
| 232 |
* Fix warnings about variables set but not used. |
| 233 |
* :file:`contrib/dbs/xtiff/xtiff.c`: Enlarge some fixed-size buffers that weren't |
| 234 |
large enough, and eliminate substantially all uses of ``sprintf(buf, |
| 235 |
...)`` in favor of using ``snprintf(buf, sizeof(buf), ...)``, so as to |
| 236 |
protect against overflow of fixed-size buffers. |