v4.0.9.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. Changes in TIFF v4.0.9
  6. </TITLE>
  7. </HEAD>
  8. <BODY BGCOLOR=white>
  9. <FONT FACE="Helvetica, Arial, Sans">
  10. <BASEFONT SIZE=4>
  11. <B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
  12. <BASEFONT SIZE=3>
  13. <UL>
  14. <HR SIZE=4 WIDTH=65% ALIGN=left>
  15. <B>Current Version</B>: v4.0.9<BR>
  16. <B>Previous Version</B>: <A HREF=v4.0.8.html>v4.0.8</a><BR>
  17. <B>Master Download Site</B>: <A HREF="https://download.osgeo.org/libtiff">
  18. download.osgeo.org</a>, directory pub/libtiff</A><BR>
  19. <B>Master HTTP Site #1</B>: <A HREF="http://www.simplesystems.org/libtiff/">
  20. http://www.simplesystems.org/libtiff/</a><BR>
  21. <B>Master HTTP Site #2</B>: <A HREF="http://libtiff.maptools.org/">
  22. http://libtiff.maptools.org/</a>
  23. <HR SIZE=4 WIDTH=65% ALIGN=left>
  24. </UL>
  25. <P>
  26. This document describes the changes made to the software between the
  27. <I>previous</I> and <I>current</I> versions (see above). If you don't
  28. find something listed here, then it was not done in this timeframe, or
  29. it was not considered important enough to be mentioned. The following
  30. information is located here:
  31. <UL>
  32. <LI><A HREF="#highlights">Major Changes</A>
  33. <LI><A HREF="#configure">Changes in the software configuration</A>
  34. <LI><A HREF="#libtiff">Changes in libtiff</A>
  35. <LI><A HREF="#tools">Changes in the tools</A>
  36. <LI><A HREF="#contrib">Changes in the contrib area</A>
  37. </UL>
  38. <p>
  39. <P><HR WIDTH=65% ALIGN=left>
  40. <!--------------------------------------------------------------------------->
  41. <A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
  42. <UL>
  43. <LI> None
  44. </UL>
  45. <P><HR WIDTH=65% ALIGN=left>
  46. <!--------------------------------------------------------------------------->
  47. <A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
  48. <UL>
  49. <LI> test/Makefile.am: Add some tests for tiff2bw.
  50. <LI> * .appveyor.yml, .travis.yml, build/travis-ci: apply patches
  51. 0001-ci-Travis-script-improvements.patch and
  52. 0002-ci-Invoke-helper-script-via-shell.patch by Roger Leigh
  53. (sent to mailing list)
  54. <LI> .travis.yml, build/travis-ci: new files from
  55. 0001-ci-Add-Travis-support-for-Linux-builds-with-Autoconf.patch by
  56. Roger Leigh (sent to mailing list on 2017-06-08)
  57. This patch adds support for the Travis-CI service.
  58. <LI> .appveyor.yml: new file from
  59. 0002-ci-Add-AppVeyor-support.patch by Roger Leigh (sent to mailing
  60. list on 2017-06-08)
  61. This patch adds a .appveyor.yml file to the top-level. This allows
  62. one to opt in to having a branch built on Windows with Cygwin,
  63. MinGW and MSVC automatically when a branch is pushed to GitHub,
  64. GitLab, BitBucket or any other supported git hosting service.
  65. <LI> CMakeLists.txt, test/CMakeLists.txt, test/TiffTestCommon.cmake: apply
  66. patch 0001-cmake-Improve-Cygwin-and-MingGW-test-support.patch from Roger
  67. Leigh (sent to mailing list on 2017-06-08)
  68. This patch makes the CMake build system support running the tests
  69. with MinGW or Cygwin.
  70. <LI> test/tiffcp-lzw-compat.sh, test/images/quad-lzw-compat.tiff: new files
  71. to test old-style LZW decompression
  72. <LI> test/common.sh, Makefile.am, CMakeList.txt: updated with above
  73. <LI> test/Makefile.am: add missing reference to images/quad-lzw-compat.tiff
  74. to fix "make distcheck". Patch by Roger Leigh
  75. <LI> nmake.opt: support a DEBUG=1 option, so as to adjust OPTFLAGS and use
  76. /MDd runtime in debug mode.
  77. </UL>
  78. <P><HR WIDTH=65% ALIGN=left>
  79. <!--------------------------------------------------------------------------->
  80. <A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
  81. <UL>
  82. <LI> libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter clamping to avoid
  83. int32 overflow in TIFFYCbCrtoRGB().
  84. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844
  85. Credit to OSS Fuzz
  86. <LI> libtiff/tif_getimage.c: initYCbCrConversion(): stricter validation for
  87. refBlackWhite coefficients values. To avoid invalid float->int32 conversion
  88. (when refBlackWhite[0] == 2147483648.f)
  89. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1907
  90. Credit to OSS Fuzz
  91. <LI> libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
  92. and use it in TIFFReadDirectory() so as to ignore fields whose tag is a
  93. codec-specified tag but this codec is not enabled. This avoids TIFFGetField()
  94. to behave differently depending on whether the codec is enabled or not, and
  95. thus can avoid stack based buffer overflows in a number of TIFF utilities
  96. such as tiffsplit, tiffcmp, thumbnail, etc.
  97. Patch derived from 0063-Handle-properly-CODEC-specific-tags.patch
  98. (http://bugzilla.maptools.org/show_bug.cgi?id=2580) by Raphaël Hertzog.
  99. Fixes:
  100. http://bugzilla.maptools.org/show_bug.cgi?id=2580
  101. http://bugzilla.maptools.org/show_bug.cgi?id=2693
  102. http://bugzilla.maptools.org/show_bug.cgi?id=2625 (CVE-2016-10095)
  103. http://bugzilla.maptools.org/show_bug.cgi?id=2564 (CVE-2015-7554)
  104. http://bugzilla.maptools.org/show_bug.cgi?id=2561 (CVE-2016-5318)
  105. http://bugzilla.maptools.org/show_bug.cgi?id=2499 (CVE-2014-8128)
  106. http://bugzilla.maptools.org/show_bug.cgi?id=2441
  107. http://bugzilla.maptools.org/show_bug.cgi?id=2433
  108. <LI> libtiff/tif_swab.c: if DISABLE_CHECK_TIFFSWABMACROS is defined, do not do
  109. the #ifdef TIFFSwabXXX checks. Make it easier for GDAL to rename the symbols
  110. of its internal libtiff copy.
  111. <LI> libtiff/tif_dirread.c: fix regression of libtiff 4.0.8 in
  112. ChopUpSingleUncompressedStrip() regarding update of newly single-strip
  113. uncompressed files whose bytecount is 0. Before the change of 2016-12-03,
  114. the condition bytecount==0 used to trigger an early exit/disabling of
  115. strip chop. Re-introduce that in update mode. Otherwise this cause
  116. later incorrect setting for the value of StripByCounts/StripOffsets.
  117. ( https://trac.osgeo.org/gdal/ticket/6924 )
  118. <LI> libtiff/tif_dirread.c: TIFFFetchStripThing(): limit the number of items
  119. read in StripOffsets/StripByteCounts tags to the number of strips to avoid
  120. excessive memory allocation.
  121. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2215
  122. Credit to OSS Fuzz
  123. <LI> libtiff/tif_getimage.c: avoid many (harmless) unsigned int overflows.
  124. <LI> libtiff/tif_fax3.c: avoid unsigned int overflow in Fax3Encode2DRow(). Could
  125. potentially be a bug with huge rows.
  126. <LI> libtiff/tif_jpeg.c: avoid (harmless) unsigned int overflow on tiled images.
  127. <LI> libtiff/tif_dirread.c: avoid unsigned int overflow in EstimateStripByteCounts()
  128. and BYTECOUNTLOOKSBAD when file is too short.
  129. <LI> libtiff/tif_predict.c: decorate legitimate functions where unsigned int
  130. overflow occur with TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
  131. * libtiff/tif_dirread.c: avoid unsigned int overflow in EstimateStripByteCounts()
  132. <LI> libtiff/tiffiop.h: add TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW macro to
  133. disable CLang warnings raised by -fsanitize=undefined,unsigned-integer-overflow
  134. <LI> libtiff/tif_jpeg.c: add anti-denial of service measure to avoid excessive
  135. CPU consumption on progressive JPEGs with a huge number of scans.
  136. See http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
  137. Note: only affects libtiff since 2014-12-29 where support of non-baseline JPEG
  138. was added.
  139. <LI> libtiff/tif_jpeg.c: error out at decoding time if anticipated libjpeg
  140. memory allocation is above 100 MB. libjpeg in case of multiple scans,
  141. which is allowed even in baseline JPEG, if components are spread over several
  142. scans and not interleavedin a single one, needs to allocate memory (or
  143. backing store) for the whole strip/tile.
  144. See http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
  145. This limitation may be overridden by setting the
  146. LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, or recompiling
  147. libtiff with a custom value of TIFF_LIBJPEG_LARGEST_MEM_ALLOC macro.
  148. <LI> libtiff/tif_jbig.c: fix memory leak in error code path of JBIGDecode()
  149. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2706
  150. Reported by team OWL337
  151. <LI> libtiff/tif_dirread.c: in TIFFReadDirEntryFloat(), check that a
  152. double value can fit in a float before casting. Patch by Nicolas RUFF
  153. <LI> libtiff/tiffiop.h, libtiff/tif_jpeg.c, libtiff/tif_jpeg_12.c,
  154. libtiff/tif_read.c: make TIFFReadScanline() works in
  155. CHUNKY_STRIP_READ_SUPPORT mode with JPEG stream with multiple scans.
  156. Also make configurable through a LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER
  157. environment variable the maximum number of scans allowed. Defaults to
  158. 100.
  159. <LI> libtiff/tif_read.c: TIFFFillTile(): add limitation to the number
  160. of bytes read in case td_stripbytecount[strip] is bigger than
  161. reasonable, so as to avoid excessive memory allocation (similarly to
  162. what was done for TIFFFileStrip() on 2017-05-10)
  163. <LI> libtiff/tif_getimage.c: use _TIFFReadEncodedStripAndAllocBuffer().
  164. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2708 and
  165. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2433 .
  166. Credit to OSS Fuzz
  167. <LI> libtiff/tif_read.c, tiffiop.h: add a _TIFFReadEncodedStripAndAllocBuffer()
  168. function, variant of TIFFReadEncodedStrip() that allocates the
  169. decoded buffer only after a first successful TIFFFillStrip(). This avoids
  170. excessive memory allocation on corrupted files.
  171. <LI> libtiff/tif_dirwrite.c: in TIFFWriteDirectoryTagCheckedXXXX()
  172. functions associated with LONG8/SLONG8 data type, replace assertion that
  173. the file is BigTIFF, by a non-fatal error.
  174. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2712
  175. Reported by team OWL337
  176. <LI> libtiff/tif_read.c: TIFFStartTile(): set tif_rawcc to
  177. tif_rawdataloaded when it is set. Similarly to TIFFStartStrip().
  178. This issue was revealed by the change of 2017-06-30 in TIFFFileTile(),
  179. limiting the number of bytes read. But it could probably have been hit
  180. too in CHUNKY_STRIP_READ_SUPPORT mode previously ?
  181. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2454
  182. Credit to OSS Fuzz
  183. <LI> libtiff/tif_error.c, tif_warning.c: correctly use va_list when both
  184. an old-style and new-style warning/error handlers are installed.
  185. Patch by Paavo Helde (sent on the mailing list)
  186. <LI> libtiff/tif_getimage.c: use _TIFFReadTileAndAllocBuffer().
  187. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2470
  188. Credit to OSS Fuzz.
  189. <LI> libtiff/tif_read.c, tiffiop.h: add a _TIFFReadEncodedTileAndAllocBuffer()
  190. and _TIFFReadTileAndAllocBuffer() variants of TIFFReadEncodedTile() and
  191. TIFFReadTile() that allocates the decoded buffer only after a first
  192. successful TIFFFillTile(). This avoids excessive memory allocation
  193. on corrupted files.
  194. <LI> libtiff/tif_pixarlog.c: avoid excessive memory allocation on decoding
  195. when RowsPerStrip tag is not defined (and thus td_rowsperstrip == UINT_MAX)
  196. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2554
  197. Credit to OSS Fuzz
  198. <LI> libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW
  199. compressed files.
  200. <LI> libtiff/tif_lzw.c: fix potential out-of-buffer read on 1-byte LZW
  201. strips. Crashing issue only on memory mapped files, where the strip
  202. offset is the last byte of the file, and the file size is a multiple
  203. of one page size on the CPU architecture (typically 4096). Credit
  204. to myself :-)
  205. <LI> libtiff/tif_dir.c: avoid potential null pointer dereference in
  206. _TIFFVGetField() on corrupted TIFFTAG_NUMBEROFINKS tag instance.
  207. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2713
  208. <LI> tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
  209. mode on PlanarConfig=Contig input images.
  210. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2715
  211. Reported by team OWL337
  212. <LI> libtiff/tif_read.c: TIFFFillStrip() / TIFFFillTile().
  213. Complementary fix for http://bugzilla.maptools.org/show_bug.cgi?id=2708
  214. in the isMapped() case, so as to avoid excessive memory allocation
  215. when we need a temporary buffer but the file is truncated.
  216. <LI> libtiff/tif_read.c: TIFFFillStrip() / TIFFFillTile().
  217. Complementary fix for http://bugzilla.maptools.org/show_bug.cgi?id=2708
  218. in the isMapped() case, so as to avoid excessive memory allocation
  219. when we need a temporary buffer but the file is truncated.
  220. <LI> libtiff/tif_read.c: in TIFFFetchStripThing(), only grow the
  221. arrays that hold StripOffsets/StripByteCounts, when they are smaller
  222. than the expected number of striles, up to 1 million striles, and
  223. error out beyond. Can be tweaked by setting the environment variable
  224. LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT.
  225. This partially goes against a change added on 2002-12-17 to accept
  226. those arrays of wrong sizes, but is needed to avoid denial of services.
  227. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2350
  228. Credit to OSS Fuzz
  229. <LI> libtiff/tif_read.c: in TIFFFetchStripThing(), only grow the
  230. arrays that hold StripOffsets/StripByteCounts, when they are smaller
  231. than the expected number of striles, up to 1 million striles, and
  232. error out beyond. Can be tweaked by setting the environment variable
  233. LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT.
  234. This partially goes against a change added on 2002-12-17 to accept
  235. those arrays of wrong sizes, but is needed to avoid denial of services.
  236. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2350
  237. Credit to OSS Fuzz
  238. <LI> libtiff/tif_read.c: add protection against excessive memory
  239. allocation attempts in TIFFReadDirEntryArray() on short files.
  240. Effective for mmap'ed case. And non-mmap'ed case, but restricted
  241. to 64bit builds.
  242. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2675
  243. <LI> libtiff/tif_read.c: add protection against excessive memory
  244. allocation attempts in TIFFReadDirEntryArray() on short files.
  245. Effective for mmap'ed case. And non-mmap'ed case, but restricted
  246. to 64bit builds.
  247. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2675
  248. <LI> libtiff/tif_luv.c: LogLuvInitState(): avoid excessive memory
  249. allocation when RowsPerStrip tag is missing.
  250. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2683
  251. Credit to OSS-Fuzz
  252. <LI> libtiff/tif_getimage.c: gtTileContig() and gtTileSeparate():
  253. properly break from loops on error when stoponerr is set, instead
  254. of going on iterating on row based loop.
  255. <LI> libtiff/tif_getimage.c: fix fromskew computation when to-be-skipped
  256. pixel number is not a multiple of the horizontal subsampling, and
  257. also in some other cases. Impact putcontig8bitYCbCr44tile,
  258. putcontig8bitYCbCr42tile, putcontig8bitYCbCr41tile,
  259. putcontig8bitYCbCr21tile and putcontig8bitYCbCr12tile
  260. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2637 (discovered
  261. by Agostino Sarubbo)
  262. and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2691 (credit
  263. to OSS Fuzz)
  264. <LI> libtiff/tif_luv.c: further reduce memory requirements for temporary
  265. buffer when RowsPerStrip >= image_length in LogLuvInitState() and
  266. LogL16InitState().
  267. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2700
  268. Credit to OSS Fuzz
  269. <LI> libtiff/tif_dirwrite.c: replace assertion related to not finding the
  270. SubIFD tag by runtime check (in TIFFWriteDirectorySec())
  271. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2727
  272. Reported by team OWL337
  273. <LI> libtiff/tif_dirwrite.c: replace assertion to tag value not fitting
  274. on uint32 when selecting the value of SubIFD tag by runtime check
  275. (in TIFFWriteDirectoryTagSubifd()).
  276. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2728
  277. Reported by team OWL337
  278. <LI> libtiff/tif_jpeg.c: accept reading the last strip of a JPEG compressed
  279. file if the codestream height is larger than the truncated height of the
  280. strip. Emit a warning in this situation since this is non compliant.
  281. <LI> libtiff/tiffiop.h, tif_aux.c: redirect SeekOK() macro to a _TIFFSeekoK()
  282. function that checks if the offset is not bigger than INT64_MAX, so as
  283. to avoid a -1 error return code of TIFFSeekFile() to match a required
  284. seek to UINT64_MAX/-1.
  285. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2726
  286. Adapted from proposal by Nicolas Ruff.
  287. <LI> libtiff/tif_dirread.c: add NULL check to avoid likely false positive
  288. null-pointer dereference warning by CLang Static Analyzer.
  289. <LI> libtiff/libtiff.def: add TIFFReadRGBAStripExt and TIFFReadRGBATileExt
  290. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2735
  291. <LI> libtiff/tif_jpeg.c: add compatibility with libjpeg-turbo 1.5.2 that
  292. honours max_memory_to_use > 0.
  293. Cf https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162
  294. <LI> libtiff/tif_getimage.c: avoid floating point division by zero in
  295. initCIELabConversion()
  296. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3733
  297. Credit to OSS Fuzz
  298. </UL>
  299. <P><HR WIDTH=65% ALIGN=left>
  300. <!-------------------------------------------------------------------------->
  301. <A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
  302. <UL>
  303. <LI> tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
  304. mode on PlanarConfig=Contig input images.
  305. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2715
  306. Reported by team OWL337
  307. <LI> tools/tiffset.c: fix setting a single value for the ExtraSamples tag
  308. (and other tags with variable number of values).
  309. So 'tiffset -s ExtraSamples 1 X'. This only worked
  310. when setting 2 or more values, but not just one.
  311. <LI> tools/fax2tiff.c (_FAX_Client_Data): Pass FAX_Client_Data as the
  312. client data. This client data is not used at all at the moment,
  313. but it makes the most sense. Issue that the value of
  314. client_data.fd was passed where a pointer is expected was reported
  315. via email by Gerald Schade on Sun, 29 Oct 2017.
  316. <LI> tools/tiff2pdf.c (t2p_sample_realize_palette): Fix possible
  317. arithmetic overflow in bounds checking code and eliminate
  318. comparison between signed and unsigned type.
  319. <LI> tools/tiff2bw.c (main): Free memory allocated in the tiff2bw
  320. program. This is in response to the report associated with
  321. CVE-2017-16232 but does not solve the extremely high memory usage
  322. with the associated POC file.
  323. </UL>
  324. <P><HR WIDTH=65% ALIGN=left>
  325. <!--------------------------------------------------------------------------->
  326. <A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
  327. <UL>
  328. <LI> None
  329. </UL>
  330. Last updated $Date: 2017-11-18 19:38:06 $.
  331. </BODY>
  332. </HTML>