v4.0.8.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. Changes in TIFF v4.0.8
  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.8<BR>
  16. <B>Previous Version</B>: <A HREF=v4.0.7.html>v4.0.7</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> None
  50. </UL>
  51. <P><HR WIDTH=65% ALIGN=left>
  52. <!--------------------------------------------------------------------------->
  53. <A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
  54. <UL>
  55. <LI> libtiff/tif_getimage.c, libtiff/tif_open.c: add parenthesis
  56. to fix cppcheck clarifyCalculation warnings *
  57. libtiff/tif_predict.c, libtiff/tif_print.c: fix printf
  58. unsigned vs signed formatting (cppcheck
  59. invalidPrintfArgType_uint warnings)
  60. <LI> libtiff/tif_read.c, libtiff/tiffiop.h: fix uint32 overflow in
  61. TIFFReadEncodedStrip() that caused an integer division by
  62. zero. Reported by Agostino Sarubbo. Fixes
  63. http://bugzilla.maptools.org/show_bug.cgi?id=2596
  64. <LI> libtiff/tif_pixarlog.c, libtiff/tif_luv.c: fix heap-based
  65. buffer overflow on generation of PixarLog / LUV compressed
  66. files, with ColorMap, TransferFunction attached and nasty
  67. plays with bitspersample. The fix for LUV has not been
  68. tested, but suffers from the same kind of issue of PixarLog.
  69. Reported by Agostino Sarubbo. Fixes
  70. http://bugzilla.maptools.org/show_bug.cgi?id=2604
  71. <LI> libtiff/tif_strip.c: revert the change in
  72. TIFFNumberOfStrips() done for
  73. http://bugzilla.maptools.org/show_bug.cgi?id=2587 /
  74. CVE-2016-9273 since the above change is a better fix that
  75. makes it unnecessary.
  76. <LI> libtiff/tif_dirread.c: modify ChopUpSingleUncompressedStrip()
  77. to instantiate compute ntrips as
  78. TIFFhowmany_32(td->td_imagelength, rowsperstrip), instead of a
  79. logic based on the total size of data. Which is faulty is the
  80. total size of data is not sufficient to fill the whole image,
  81. and thus results in reading outside of the
  82. StripByCounts/StripOffsets arrays when using
  83. TIFFReadScanline(). Reported by Agostino Sarubbo. Fixes
  84. http://bugzilla.maptools.org/show_bug.cgi?id=2608.
  85. <LI> libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case of
  86. failure in OJPEGPreDecode(). This will avoid a divide by zero,
  87. and potential other issues. Reported by Agostino Sarubbo.
  88. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2611
  89. <LI> libtiff/tif_write.c: fix misleading indentation as warned by GCC.
  90. <LI> libtiff/tif_fax3.h: revert change done on 2016-01-09 that
  91. made Param member of TIFFFaxTabEnt structure a uint16 to
  92. reduce size of the binary. It happens that the Hylafax
  93. software uses the tables that follow this typedef
  94. (TIFFFaxMainTable, TIFFFaxWhiteTable, TIFFFaxBlackTable),
  95. although they are not in a public libtiff header. Raised by
  96. Lee Howard. Fixes
  97. http://bugzilla.maptools.org/show_bug.cgi?id=2636
  98. <LI> libtiff/tiffio.h, libtiff/tif_getimage.c: add
  99. TIFFReadRGBAStripExt() and TIFFReadRGBATileExt() variants of
  100. the functions without ext, with an extra argument to control
  101. the stop_on_error behaviour.
  102. <LI> libtiff/tif_getimage.c: fix potential memory leaks in error
  103. code path of TIFFRGBAImageBegin(). Fixes
  104. http://bugzilla.maptools.org/show_bug.cgi?id=2627
  105. <LI> libtiff/tif_jpeg.c: increase libjpeg max memory usable to 10
  106. MB instead of libjpeg 1MB default. This helps when creating
  107. files with "big" tile, without using libjpeg temporary files.
  108. Related to https://trac.osgeo.org/gdal/ticket/6757
  109. <LI> libtiff/tif_jpeg.c: avoid integer division by zero in
  110. JPEGSetupEncode() when horizontal or vertical sampling is set
  111. to 0. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653
  112. <LI> libtiff/tif_dirwrite.c: in
  113. TIFFWriteDirectoryTagCheckedRational, replace assertion by
  114. runtime check to error out if passed value is strictly
  115. negative. Fixes
  116. http://bugzilla.maptools.org/show_bug.cgi?id=2535
  117. <LI> libtiff/tif_dirread.c: avoid division by floating point 0 in
  118. TIFFReadDirEntryCheckedRational() and
  119. TIFFReadDirEntryCheckedSrational(), and return 0 in that case
  120. (instead of infinity as before presumably) Apparently some
  121. sanitizers do not like those divisions by zero. Fixes
  122. http://bugzilla.maptools.org/show_bug.cgi?id=2644
  123. <LI> libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement
  124. various clampings of double to other data types to avoid
  125. undefined behaviour if the output range isn't big enough to
  126. hold the input value. Fixes
  127. http://bugzilla.maptools.org/show_bug.cgi?id=2643
  128. http://bugzilla.maptools.org/show_bug.cgi?id=2642
  129. http://bugzilla.maptools.org/show_bug.cgi?id=2646
  130. http://bugzilla.maptools.org/show_bug.cgi?id=2647
  131. <LI> libtiff/tif_jpeg.c: validate BitsPerSample in
  132. JPEGSetupEncode() to avoid undefined behaviour caused by
  133. invalid shift exponent. Fixes
  134. http://bugzilla.maptools.org/show_bug.cgi?id=2648
  135. <LI> libtiff/tif_read.c: avoid potential undefined behaviour on
  136. signed integer addition in TIFFReadRawStrip1() in isMapped()
  137. case. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2650
  138. <LI> libtiff/tif_getimage.c: add explicit uint32 cast in
  139. putagreytile to avoid UndefinedBehaviorSanitizer warning.
  140. Patch by Nicolás Peña. Fixes
  141. http://bugzilla.maptools.org/show_bug.cgi?id=2658
  142. <LI> libtiff/tif_read.c: TIFFReadBufferSetup(): use _TIFFcalloc()
  143. to zero initialize tif_rawdata. Fixes
  144. http://bugzilla.maptools.org/show_bug.cgi?id=2651
  145. <LI> libtiff/tiffio.h, tif_unix.c, tif_win32.c, tif_vms.c: add
  146. _TIFFcalloc()
  147. <LI> libtiff/tif_luv.c, tif_lzw.c, tif_packbits.c: return 0 in
  148. Encode functions instead of -1 when TIFFFlushData1() fails.
  149. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2130
  150. <LI> libtiff/tif_ojpeg.c: fix leak in
  151. OJPEGReadHeaderInfoSecTablesQTable,
  152. OJPEGReadHeaderInfoSecTablesDcTable and
  153. OJPEGReadHeaderInfoSecTablesAcTable when read fails. Patch by
  154. Nicolás Peña. Fixes
  155. http://bugzilla.maptools.org/show_bug.cgi?id=2659
  156. <LI> libtiff/tif_jpeg.c: only run JPEGFixupTagsSubsampling() if
  157. the YCbCrSubsampling tag is not explicitly present. This helps
  158. a bit to reduce the I/O amount when the tag is present
  159. (especially on cloud hosted files).
  160. <LI> libtiff/tif_lzw.c: in LZWPostEncode(), increase, if
  161. necessary, the code bit-width after flushing the remaining
  162. code and before emitting the EOI code. Fixes
  163. http://bugzilla.maptools.org/show_bug.cgi?id=1982
  164. <LI> libtiff/tif_pixarlog.c: fix memory leak in error code path of
  165. PixarLogSetupDecode(). Patch by Nicolás Peña. Fixes
  166. http://bugzilla.maptools.org/show_bug.cgi?id=2665
  167. <LI> libtiff/tif_fax3.c, tif_predict.c, tif_getimage.c: fix GCC 7
  168. -Wimplicit-fallthrough warnings.
  169. <LI> libtiff/tif_dirread.c: fix memory leak in non
  170. DEFER_STRILE_LOAD mode (ie default) when there is both a
  171. StripOffsets and TileOffsets tag, or a StripByteCounts and
  172. TileByteCounts Fixes
  173. http://bugzilla.maptools.org/show_bug.cgi?id=2689
  174. <LI> libtiff/tif_ojpeg.c: fix potential memory leak in
  175. OJPEGReadHeaderInfoSecTablesQTable,
  176. OJPEGReadHeaderInfoSecTablesDcTable and
  177. OJPEGReadHeaderInfoSecTablesAcTable Patch by Nicolás Peña.
  178. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2670
  179. <LI> libtiff/tif_fax3.c: avoid crash in Fax3Close() on empty file.
  180. Patch by Alan Coopersmith + complement by myself. Fixes
  181. http://bugzilla.maptools.org/show_bug.cgi?id=2673
  182. <LI> libtiff/tif_read.c: TIFFFillStrip(): add limitation to the
  183. number of bytes read in case td_stripbytecount[strip] is
  184. bigger than reasonable, so as to avoid excessive memory
  185. allocation.
  186. <LI> libtiff/tif_zip.c, tif_pixarlog.c, tif_predict.c: fix memory
  187. leak when the underlying codec (ZIP, PixarLog) succeeds its
  188. setupdecode() method, but PredictorSetup fails. Credit to
  189. OSS-Fuzz (locally run, on GDAL)
  190. <LI> libtiff/tif_read.c: TIFFFillStrip() and TIFFFillTile(): avoid
  191. excessive memory allocation in case of shorten files. Only
  192. effective on 64 bit builds and non-mapped cases. Credit to
  193. OSS-Fuzz (locally run, on GDAL)
  194. <LI> libtiff/tif_read.c: TIFFFillStripPartial() / TIFFSeek(),
  195. avoid potential integer overflows with read_ahead in
  196. CHUNKY_STRIP_READ_SUPPORT mode. Should
  197. especially occur on 32 bit platforms.
  198. <LI> libtiff/tif_read.c: TIFFFillStripPartial(): avoid excessive
  199. memory allocation in case of shorten files. Only effective on
  200. 64 bit builds. Credit to OSS-Fuzz (locally run, on GDAL)
  201. <LI> libtiff/tif_read.c: update tif_rawcc in
  202. CHUNKY_STRIP_READ_SUPPORT mode with tif_rawdataloaded when
  203. calling TIFFStartStrip() or TIFFFillStripPartial(). This
  204. avoids reading beyond tif_rawdata when bytecount >
  205. tif_rawdatasize. Fixes
  206. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1545.
  207. Credit to OSS-Fuzz
  208. <LI> libtiff/tif_color.c: avoid potential int32 overflow in
  209. TIFFYCbCrToRGBInit() Fixes
  210. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1533
  211. Credit to OSS-Fuzz
  212. <LI> libtiff/tif_pixarlog.c, tif_luv.c: avoid potential int32
  213. overflows in multiply_ms() and add_ms(). Fixes
  214. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1558
  215. Credit to OSS-Fuzz
  216. <LI> libtiff/tif_packbits.c: fix out-of-buffer read in
  217. PackBitsDecode() Fixes
  218. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1563
  219. Credit to OSS-Fuzz
  220. <LI> libtiff/tif_luv.c: LogL16InitState(): avoid excessive memory
  221. allocation when RowsPerStrip tag is missing.
  222. Credit to OSS-Fuzz (locally run, on GDAL)
  223. <LI> libtiff/tif_lzw.c: update dec_bitsleft at beginning of
  224. LZWDecode(), and update tif_rawcc at end of LZWDecode(). This
  225. is needed to properly work with the latest chnges in
  226. tif_read.c in CHUNKY_STRIP_READ_SUPPORT mode.
  227. <LI> libtiff/tif_pixarlog.c: PixarLogDecode(): resync tif_rawcp
  228. with next_in and tif_rawcc with avail_in at beginning and end
  229. of function, similarly to what is done in LZWDecode(). Likely
  230. needed so that it works properly with latest chnges in
  231. tif_read.c in CHUNKY_STRIP_READ_SUPPORT mode. But untested...
  232. <LI> libtiff/tif_getimage.c: initYCbCrConversion(): add basic
  233. validation of luma and refBlackWhite coefficients (just check
  234. they are not NaN for now), to avoid potential float to int
  235. overflows. Fixes
  236. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1663
  237. Credit to OSS Fuzz
  238. <LI> libtiff/tif_read.c: _TIFFVSetField(): fix outside range cast
  239. of double to float. Credit to Google Autofuzz project
  240. <LI> libtiff/tif_getimage.c: initYCbCrConversion(): check luma[1]
  241. is not zero to avoid division by zero. Fixes
  242. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1665
  243. Credit to OSS Fuzz
  244. <LI> libtiff/tif_read.c: _TIFFVSetField(): fix outside range cast
  245. of double to float. Credit to Google Autofuzz project
  246. <LI> libtiff/tif_getimage.c: initYCbCrConversion(): check luma[1]
  247. is not zero to avoid division by zero. Fixes
  248. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1665
  249. Credit to OSS Fuzz
  250. <LI> libtiff/tif_getimage.c: initYCbCrConversion(): stricter
  251. validation for refBlackWhite coefficients values. To avoid
  252. invalid float->int32 conversion. Fixes
  253. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1718
  254. Credit to OSS Fuzz
  255. </UL>
  256. <P><HR WIDTH=65% ALIGN=left>
  257. <!-------------------------------------------------------------------------->
  258. <A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
  259. <UL>
  260. <LI> tools/fax2tiff.c (main): Applied patch by Jörg Ahrens to fix
  261. passing client data for Win32 builds using tif_win32.c
  262. (USE_WIN32_FILEIO defined) for file I/O. Patch was provided
  263. via email on November 20, 2016.
  264. <LI> tools/tiffcp.c: avoid uint32 underflow in cpDecodedStrips
  265. that can cause various issues, such as buffer overflows in the
  266. library. Reported by Agostino Sarubbo. Fixes
  267. http://bugzilla.maptools.org/show_bug.cgi?id=2598
  268. <LI> tools/tiffcrop.c: fix readContigStripsIntoBuffer() in -i
  269. (ignore) mode so that the output buffer is correctly
  270. incremented to avoid write outside bounds. Reported by
  271. Agostino Sarubbo. Fixes
  272. http://bugzilla.maptools.org/show_bug.cgi?id=2620
  273. <LI> tools/tiffcrop.c: add 3 extra bytes at end of strip buffer in
  274. readSeparateStripsIntoBuffer() to avoid read outside of heap
  275. allocated buffer. Reported by Agostino Sarubbo. Fixes
  276. http://bugzilla.maptools.org/show_bug.cgi?id=2621
  277. <LI> tools/tiffcrop.c: fix integer division by zero when
  278. BitsPerSample is missing. Reported by Agostino Sarubbo.
  279. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2619
  280. <LI> tools/tiffinfo.c: fix null pointer dereference in -r mode
  281. when the image has no StripByteCount tag. Reported by
  282. Agostino Sarubbo. Fixes
  283. http://bugzilla.maptools.org/show_bug.cgi?id=2594
  284. <LI> tools/tiffcp.c: avoid potential division by zero is
  285. BitsPerSamples tag is missing. Reported by Agostino Sarubbo.
  286. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2597
  287. <LI> tools/tif_dir.c: when TIFFGetField(, TIFFTAG_NUMBEROFINKS, )
  288. is called, limit the return number of inks to SamplesPerPixel,
  289. so that code that parses ink names doesn't go past the end of
  290. the buffer. Reported by Agostino Sarubbo. Fixes
  291. http://bugzilla.maptools.org/show_bug.cgi?id=2599
  292. <LI> tools/tiffcp.c: avoid potential division by zero is
  293. BitsPerSamples tag is missing. Reported by Agostino Sarubbo.
  294. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2607
  295. <LI> tools/tiffcp.c: fix uint32 underflow/overflow that can cause
  296. heap-based buffer overflow. Reported by Agostino Sarubbo.
  297. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2610
  298. <LI> tools/tiffcp.c: replace assert( (bps % 8) == 0 ) by a non
  299. assert check. Reported by Agostino Sarubbo. Fixes
  300. http://bugzilla.maptools.org/show_bug.cgi?id=2605
  301. <LI> tools/tiff2ps.c: fix 2 heap-based buffer overflows (in
  302. PSDataBW and PSDataColorContig). Reported by Agostino Sarubbo.
  303. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2633 and
  304. http://bugzilla.maptools.org/show_bug.cgi?id=2634.
  305. <LI> tools/tiff2pdf.c: prevent heap-based buffer overflow in -j
  306. mode on a paletted image. Note: this fix errors out before the
  307. overflow happens. There could probably be a better fix. Fixes
  308. http://bugzilla.maptools.org/show_bug.cgi?id=2635
  309. <LI> tools/tiff2pdf.c: fix wrong usage of memcpy() that can
  310. trigger unspecified behaviour. Fixes
  311. http://bugzilla.maptools.org/show_bug.cgi?id=2638
  312. <LI> tools/tiff2pdf.c: avoid potential invalid memory read in
  313. t2p_writeproc. Fixes
  314. http://bugzilla.maptools.org/show_bug.cgi?id=2639
  315. <LI> tools/tiff2pdf.c: avoid potential heap-based overflow in
  316. t2p_readwrite_pdf_image_tile(). Fixes
  317. http://bugzilla.maptools.org/show_bug.cgi?id=2640
  318. <LI> tools/tiffcrop.c: remove extraneous TIFFClose() in error code
  319. path, that caused double free. Related to
  320. http://bugzilla.maptools.org/show_bug.cgi?id=2535
  321. <LI> tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow
  322. and cpSeparate2ContigByRow if BitsPerSample != 8 to avoid heap
  323. based overflow. Fixes
  324. http://bugzilla.maptools.org/show_bug.cgi?id=2656 and
  325. http://bugzilla.maptools.org/show_bug.cgi?id=2657
  326. <LI> tools/raw2tiff.c: avoid integer division by zero. Fixes
  327. http://bugzilla.maptools.org/show_bug.cgi?id=2631
  328. <LI> tools/tiff2ps.c: call TIFFClose() in error code paths.
  329. <LI> tools/fax2tiff.c: emit appropriate message if the input file
  330. is empty. Patch by Alan Coopersmith. Fixes
  331. http://bugzilla.maptools.org/show_bug.cgi?id=2672
  332. <LI> tools/tiff2bw.c: close TIFF handle in error code path. Fixes
  333. http://bugzilla.maptools.org/show_bug.cgi?id=2677
  334. </UL>
  335. <P><HR WIDTH=65% ALIGN=left>
  336. <!--------------------------------------------------------------------------->
  337. <A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
  338. <UL>
  339. <LI> None
  340. </UL>
  341. Last updated $Date: 2017-05-21 17:47:46 $.
  342. </BODY>
  343. </HTML>