Debian Codegraph @

doc/releases/v4.0.7.rst

raw
1 Changes in TIFF v4.0.7
2 ======================
3
4 .. table:: References
5 :widths: auto
6
7 ====================== ==========================================
8 Current Version v4.0.7 (:tag:`Release-v4-0-7`)
9 Previous Version :doc:`v4.0.6 <v4.0.6>`
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 This document describes the changes made to the software between the
16 *previous* and *current* versions (see above). If you don't
17 find something listed here, then it was not done in this timeframe, or
18 it was not considered important enough to be mentioned. The following
19 information is located here:
20
21 Major changes
22 -------------
23
24 * The libtiff tools :program:`bmp2tiff`, :program:`gif2tiff`, :program:`ras2tiff`, :program:`sgi2tiff`,
25 :program:`sgisv`, and :program:`ycbcr` are completely removed from the distribution.
26 these tools were written in the late 1980s and early 1990s for
27 test and demonstration purposes. In some cases the tools were
28 never updated to support updates to the file format, or the
29 file formats are now rarely used. In all cases these tools
30 increased the libtiff security and maintenance exposure beyond
31 the value offered by the tool.
32
33 Software configuration changes
34 ------------------------------
35
36 * None
37
38 Library changes
39 ---------------
40
41 * :file:`libtiff/tif_dirread.c`: in :c:func:`TIFFFetchNormalTag`, do not
42 dereference :c:macro:`NULL` pointer when values of tags with
43 :c:macro:`TIFF_SETGET_C16_ASCII` / :c:macro:`TIFF_SETGET_C32_ASCII` access are
44 0-byte arrays. Fixes
45 :bugzilla:`2593` (regression
46 introduced by previous fix done on 2016-11-11 for
47 :cve:`2016-9297`). Reported by Henri Salo. Assigned as
48 :cve:`2016-9448`
49
50 * :file:`libtiff/tif_aux.c`: fix crash in :c:func:`TIFFVGetFieldDefaulted` when
51 requesting Predictor tag and that the zip/lzw codec is not
52 configured. Fixes
53 :bugzilla:`2591`
54
55 * :file:`libtiff/tif_dirread.c`: in :c:func:`TIFFFetchNormalTag`, make sure
56 that values of tags with :c:macro:`TIFF_SETGET_C16_ASCII` /
57 :c:macro:`TIFF_SETGET_C32_ASCII` access are :c:macro:`NULL` terminated, to avoid
58 potential read outside buffer in :c:func:`_TIFFPrintField`. Fixes
59 :bugzilla:`2590`
60
61 * :file:`libtiff/tif_dirread.c`: reject images with OJPEG compression
62 that have no ``TileOffsets``/``StripOffsets`` tag, when OJPEG
63 compression is disabled. Prevent :c:macro:`NULL` pointer dereference in
64 :c:func:`TIFFReadRawStrip1` and other functions that expect
65 :c:member:`td_stripbytecount` to be non :c:macro:`NULL`. Fixes
66 :bugzilla:`2585`
67
68 * :file:`libtiff/tif_strip.c`: make :c:func:`TIFFNumberOfStrips` return the
69 ``td->td_nstrips`` value when it is non-zero, instead of
70 recomputing it. This is needed in :c:macro:`TIFF_STRIPCHOP` mode where
71 :c:member:`td_nstrips` is modified. Fixes a read outsize of array in
72 :program:`tiffsplit` (or other utilities using :c:func:`TIFFNumberOfStrips`).
73 Fixes :bugzilla:`2587`
74 (:cve:`2016-9273`)
75
76 * :file:`libtiff/tif_predict.h`, :file:`libtiff/tif_predict.c`: Replace
77 assertions by runtime checks to avoid assertions in debug
78 mode, or buffer overflows in release mode. Can happen when
79 dealing with unusual tile size like YCbCr with
80 subsampling. Reported as MSVR 35105 by Axel Souchet & Vishal
81 Chauhan from the MSRC Vulnerabilities & Mitigations
82
83 * :file:`libtiff/tif_dir.c`: discard values of ``SMinSampleValue`` and
84 ``SMaxSampleValue`` when they have been read and the value of
85 ``SamplesPerPixel`` is changed afterwards (like when reading a
86 OJPEG compressed image with a missing ``SamplesPerPixel`` tag, and
87 whose photometric is ``RGB`` or ``YCbCr``, forcing ``SamplesPerPixel``
88 being 3). Otherwise when rewriting the directory (for example
89 with tiffset, we will expect 3 values whereas the array had
90 been allocated with just one), thus causing a out of bound
91 read access. Fixes
92 :bugzilla:`2500`
93 (:cve:`2014-8127`, duplicate: :cve:`2016-3658`)
94
95 * :file:`libtiff/tif_dirwrite.c`: avoid :c:macro:`NULL` pointer dereference on
96 :c:member:`td_stripoffset` when writing directory, if :c:macro:`FIELD_STRIPOFFSETS`
97 was artificially set for a hack case in OJPEG case. Fixes
98 :bugzilla:`2500`
99 (:cve:`2014-8127`, duplicate: :cve:`2016-3658`)
100
101 * :file:`libtiff/tif_getimage.c` (:c:func:`TIFFRGBAImageOK`): Reject attempts to
102 read floating point images.
103
104 * :file:`libtiff/tif_predict.c` (:c:func:`PredictorSetup`): Enforce
105 bits-per-sample requirements of floating point predictor (3).
106 Fixes :cve:`2016-3622` "Divide By Zero in the :program:`tiff2rgba` tool."
107
108 * :file:`libtiff/tif_pixarlog.c`: fix out-of-bounds write vulnerabilities
109 in heap allocated buffers. Reported as MSVR 35094. Discovered by
110 Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities &
111 Mitigations team.
112
113 * :file:`libtiff/tif_write.c`: fix issue in error code path of
114 :c:func:`TIFFFlushData1` that didn't reset the :c:member:`tif_rawcc` and :c:member:`tif_rawcp`
115 members. I'm not completely sure if that could happen in
116 practice outside of the odd behaviour of :c:func:`t2p_seekproc` of
117 tiff2pdf). The report points that a better fix could be to
118 check the return value of :c:func:`TIFFFlushData1` in places where it
119 isn't done currently, but it seems this patch is enough.
120 Reported as MSVR 35095. Discovered by Axel Souchet & Vishal
121 Chauhan & Suha Can from the MSRC Vulnerabilities & Mitigations
122 team.
123
124 * :file:`libtiff/tif_pixarlog.c`: Fix write buffer overflow in
125 :c:func:`PixarLogEncode` if more input samples are provided than
126 expected by :c:func:`PixarLogSetupEncode`. Idea based on
127 :file:`libtiff-CVE-2016-3990.patch` from
128 :file:`libtiff-4.0.3-25.el7_2.src.rpm` by Nikola Forro, but with
129 different and simpler check. (:bugzilla:`2544`)
130
131 * :file:`libtiff/tif_read.c`: Fix out-of-bounds read on memory-mapped
132 files in :c:func:`TIFFReadRawStrip1` and :c:func:`TIFFReadRawTile1` when
133 ``stripoffset`` is beyond :c:type:`tmsize_t` max value (reported by Mathias
134 Svensson)
135
136 * :file:`libtiff/tif_read.c`: make :c:func:`TIFFReadEncodedStrip` and
137 :c:func:`TIFFReadEncodedTile` directly use user provided buffer when
138 no compression (and other conditions) to save a :c:func:`memcpy`
139
140 * :file:`libtiff/tif_write.c`: make :c:func:`TIFFWriteEncodedStrip` and
141 :c:func:`TIFFWriteEncodedTile` directly use user provided buffer when
142 no compression to save a :c:func:`memcpy`.
143
144 * :file:`libtiff/tif_luv.c`: validate that for :c:macro:`COMPRESSION_SGILOG` and
145 :c:macro:`PHOTOMETRIC_LOGL`, there is only one sample per pixel. Avoid
146 potential invalid memory write on corrupted/unexpected images
147 when using the :c:func:`TIFFRGBAImageBegin` interface (reported by
148 Clay Wood)
149
150 * :file:`libtiff/tif_pixarlog.c`: fix potential buffer write overrun in
151 :c:func:`PixarLogDecode` on corrupted/unexpected images (reported by
152 Mathias Svensson) (:cve:`2016-5875`)
153
154 * libtiff/libtiff.def: Added ``_TIFFMultiply32`` and
155 ``_TIFFMultiply64`` to libtiff.def
156
157 * :file:`libtiff/tif_config.vc.h` (:c:macro:`HAVE_SNPRINTF`): Add a '1' to the
158 :c:macro:`HAVE_SNPRINTF` definition.
159
160 * :file:`libtiff/tif_config.vc.h` (:c:macro:`HAVE_SNPRINTF`): Applied patch by
161 Edward Lam to define :c:macro:`HAVE_SNPRINTF` for Visual Studio 2015.
162
163 * :file:`libtiff/tif_dirread.c`: when compiled with :c:macro:`DEFER_STRILE_LOAD`,
164 fix regression, introduced on 2014-12-23, when reading a
165 one-strip file without a ``StripByteCounts`` tag. GDAL #6490
166
167 * :file:`libtiff/*`: upstream typo fixes (mostly contributed by Kurt
168 Schwehr) coming from GDAL internal libtiff
169
170 * :file:`libtiff/tif_fax3.h`: make :c:member:`Param` member of :c:struct:`TIFFFaxTabEnt`
171 structure a :c:type:`uint16` to reduce size of the binary.
172
173 * :file:`libtiff/tif_read.c`, :file:`tif_dirread.c`: fix indentation issues
174 raised by GCC 6 ``-Wmisleading-indentation``
175
176 * :file:`libtiff/tif_pixarlog.c`: avoid zlib error messages to pass a
177 :c:macro:`NULL` string to ``%s`` formatter, which is undefined behaviour in
178 :c:func:`sprintf`.
179
180 * :file:`libtiff/tif_next.c`: fix potential out-of-bound write in :c:func:`NeXTDecode`
181 triggered by `<http://lcamtuf.coredump.cx/afl/vulns/libtiff5.tif>`_
182 (:bugzilla:`2508`)
183
184 * :file:`libtiff/tif_luv.c`: fix potential out-of-bound writes in
185 decode functions in non debug builds by replacing :c:func:`assert` by
186 regular ``if`` checks (:bugzilla:`2522`). Fix potential
187 out-of-bound reads in case of short input data.
188
189 * :file:`libtiff/tif_getimage.c`: fix out-of-bound reads in
190 :c:type:`TIFFRGBAImage` interface in case of unsupported values of
191 ``SamplesPerPixel``/``ExtraSamples`` for LogLUV / CIELab. Add explicit
192 call to :c:func:`TIFFRGBAImageOK` in :c:func:`TIFFRGBAImageBegin`. Fix
193 :cve:`2015-8665` reported by limingxing and :cve:`2015-8683`
194 reported by zzf of Alibaba.
195
196 * :file:`libtiff/tif_dirread.c`: workaround false positive warning of
197 Clang Static Analyzer about :c:macro:`NULL` pointer dereference in
198 :c:func:`TIFFCheckDirOffset`.
199
200 * :file:`libtiff/tif_fax3.c`: remove dead assignment in
201 :c:func:`Fax3PutEOLgdal`. Found by Clang Static Analyzer
202
203 * :file:`libtiff/tif_dirwrite.c`: fix truncation to 32 bit of file
204 offsets in :c:func:`TIFFLinkDirectory` and :c:func:`TIFFWriteDirectorySec`
205 when aligning directory offsets on a even offset (affects
206 BigTIFF). This was a regression of the changeset of
207 2015-10-19.
208
209 * :file:`libtiff/tif_write.c`: :c:func:`TIFFWriteEncodedStrip` and
210 :c:func:`TIFFWriteEncodedTile` should return -1 in case of failure of
211 :c:func:`tif_encodestrip` as documented
212
213 * :file:`libtiff/tif_dumpmode.c`: :c:func:`DumpModeEncode` should return 0 in
214 case of failure so that the above mentioned functions detect
215 the error.
216
217 * :file:`libtiff/*.c`: fix MSVC warnings related to cast shortening and
218 assignment within conditional expression
219
220 * :file:`libtiff/*.c`: fix clang -Wshorten-64-to-32 warnings
221
222 * :file:`libtiff/tif_dirread.c`: prevent reading ColorMap or
223 TransferFunction if ``BitsPerPixel`` > 24, so as to avoid huge
224 memory allocation and file read attempts
225
226 * :file:`libtiff/tif_dirread.c`: remove duplicated assignment (reported
227 by Clang static analyzer)
228
229 * :file:`libtiff/tif_dir.c`, :file:`libtiff/tif_dirinfo.c`,
230 :file:`libtiff/tif_compress.c`, :file:`libtiff/tif_jpeg_12.c`: suppress
231 warnings about 'no previous declaration/prototype'
232
233 * :file:`libtiff/tiffiop.h`, :file:`libtiff/tif_dirwrite.c`: suffix constants
234 by U to fix 'warning: negative integer implicitly converted to
235 unsigned type' warning (part of ``-Wconversion``)
236
237 * :file:`libtiff/tif_dir.c`, :file:`libtiff/tif_dirread.c`,
238 :file:`libtiff/tif_getimage.c`, :file:`libtiff/tif_print.c`: fix ``-Wshadow``
239 warnings (only in :file:`libtiff/`)
240
241
242 Tools changes
243 -------------
244
245 * tools/Makefile.am: The libtiff tools :program:`bmp2tiff`, :program:`gif2tiff`,
246 :program:`ras2tiff`, :program:`sgi2tiff`, :program:`sgisv`, and :program:`ycbcr` are completely removed
247 from the distribution. The libtiff tools :program:`rgb2ycbcr` and
248 :program:`thumbnail` are only built in the build tree for testing. Old
249 files are put in new :file:`archive` subdirectory of the source
250 repository, but not in distribution archives. These changes
251 are made in order to lessen the maintenance burden.
252
253 * :file:`tools/tiff2pdf.c`: avoid undefined behaviour related to
254 overlapping of source and destination buffer in :c:func:`memcpy` call
255 in :c:func:`t2p_sample_rgbaa_to_rgb` Fixes
256 :bugzilla:`2577`
257
258 * :file:`tools/tiff2pdf.c`: fix potential integer overflows on 32 bit
259 builds in :c:func:`t2p_read_tiff_size` Fixes
260 :bugzilla:`2576`
261
262 * :file:`tools/fax2tiff.c`: fix segfault when specifying ``-r`` without
263 argument. Patch by Yuriy M. Kaminskiy. Fixes
264 :bugzilla:`2572`
265
266 * :file:`tools/tiffinfo.c`: fix out-of-bound read on some tiled images.
267 (:bugzilla:`2517`)
268
269 * :file:`tools/tiffcrop.c`: fix multiple uint32 overflows in
270 :c:func:`writeBufferToSeparateStrips`, :c:func:`writeBufferToContigTiles` and
271 :c:func:`writeBufferToSeparateTiles` that could cause heap buffer
272 overflows. Reported by Henri Salo from Nixu Corporation.
273 Fixes :bugzilla:`2592`
274
275 * :file:`tools/tiffcrop.c`: fix out-of-bound read of up to 3 bytes in
276 :c:func:`readContigTilesIntoBuffer`. Reported as MSVR 35092 by Axel
277 Souchet & Vishal Chauhan from the MSRC Vulnerabilities &
278 Mitigations team.
279
280 * :file:`tools/tiff2pdf.c`: fix write buffer overflow of 2 bytes on
281 JPEG compressed images. Reported by Tyler Bohan of Cisco Talos
282 as TALOS-CAN-0187 / :cve:`2016-5652`. Also prevents writing 2
283 extra uninitialized bytes to the file stream.
284
285 * :file:`tools/tiffcp.c`: fix out-of-bounds write on tiled images with odd
286 tile width vs image width. Reported as MSVR 35103
287 by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities &
288 Mitigations team.
289
290 * :file:`tools/tiff2pdf.c`: fix read -largely- outsize of buffer in
291 :c:func:`t2p_readwrite_pdf_image_tile`, causing crash, when reading a
292 JPEG compressed image with :c:macro:`TIFFTAG_JPEGTABLES` length being
293 one. Reported as MSVR 35101 by Axel Souchet and Vishal
294 Chauhan from the MSRC Vulnerabilities & Mitigations team.
295
296 * :file:`tools/tiffcp.c`: fix read of undefined variable in case of
297 missing required tags. Found on test case of MSVR 35100.
298
299 * :file:`tools/tiffcrop.c`: fix read of undefined buffer in
300 :c:func:`readContigStripsIntoBuffer` due to uint16 overflow. Probably
301 not a security issue but I can be wrong. Reported as MSVR
302 35100 by Axel Souchet from the MSRC Vulnerabilities &
303 Mitigations team.
304
305 * :file:`tools/tiffcrop.c`: fix various out-of-bounds write
306 vulnerabilities in heap or stack allocated buffers. Reported
307 as MSVR 35093, MSVR 35096 and MSVR 35097. Discovered by Axel
308 Souchet and Vishal Chauhan from the MSRC Vulnerabilities &
309 Mitigations team.
310
311 * :file:`tools/tiff2pdf.c`: fix out-of-bounds write vulnerabilities in
312 heap allocate buffer in :c:func:`t2p_process_jpeg_strip`. Reported as
313 MSVR 35098. Discovered by Axel Souchet and Vishal Chauhan from
314 the MSRC Vulnerabilities & Mitigations team.
315
316 * :file:`tools/tiff2bw.c`: fix weight computation that could result of
317 color value overflow (no security implication). Fix :bugzilla:`2550`.
318 Patch by Frank Freudenberg.
319
320 * :file:`tools/rgb2ycbcr.c`: validate values of ``-v`` and ``-h`` parameters to
321 avoid potential divide by zero. Fixes :cve:`2016-3623` (:bugzilla:`2569`)
322
323 * :file:`tools/tiffcrop.c`: Fix out-of-bounds write in :c:func:`loadImage`.
324 From patch :file:`libtiff-CVE-2016-3991.patch` from
325 :file:`libtiff-4.0.3-25.el7_2.src.rpm` by Nikola Forro (:bugzilla:`2543`)
326
327 * :file:`tools/tiff2rgba.c`: Fix integer overflow in size of allocated
328 buffer, when ``-b`` mode is enabled, that could result in
329 out-of-bounds write. Based initially on patch
330 :file:`tiff-CVE-2016-3945.patch` from :file:`libtiff-4.0.3-25.el7_2.src.rpm`
331 by Nikola Forro, with correction for invalid tests that
332 rejected valid files. (:bugzilla:`2545`)
333
334 * :file:`tools/tiffcrop.c`: Avoid access outside of stack allocated
335 array on a tiled separate TIFF with more than 8 samples per
336 pixel. Reported by Kaixiang Zhang of the Cloud Security Team,
337 Qihoo 360 (:cve:`2016-5321` / :cve:`2016-5323` , :bugzilla:`2558` /
338 :bugzilla:`2559`)
339
340 * :file:`tools/tiffdump.c`: fix a few misaligned 64-bit reads warned by
341 ``-fsanitize``
342
343 * :file:`tools/tiffdump.c` (:c:func:`ReadDirectory`): Remove :c:type:`uint32` cast to
344 :c:func:`_TIFFmalloc` argument which resulted in Coverity report.
345 Added more multiplication overflow checks.
346
347 Contributed software changes
348 ----------------------------
349
350 None