diff options
author | Eirik Aavitsland <eirik.aavitsland@theqtcompany.com> | 2015-11-25 14:25:31 +0100 |
---|---|---|
committer | aavit <eirik.aavitsland@theqtcompany.com> | 2015-12-09 12:25:16 +0000 |
commit | 6730d70f001c9492d32a6a8e95c304a52d7ddc35 (patch) | |
tree | 1553ae391ec42af87ba32a52fa28f3cea2764980 /src | |
parent | de4f14476c24eb4cf52948af92220a2a6462c823 (diff) | |
download | qtimageformats-6730d70f001c9492d32a6a8e95c304a52d7ddc35.tar.gz |
Bundled libtiff updated to version 4.0.6v5.6.0-beta1
Upstream changes since 4.0.3 have been merged in. Our local tif_conf.h
have been updated according to the upstream changes in tif_conf.h.in.
Change-Id: I1c2aef6f0f60377de4876e25df723c32a6f95ea6
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src')
39 files changed, 2594 insertions, 1012 deletions
diff --git a/src/3rdparty/libtiff.pri b/src/3rdparty/libtiff.pri index bc97ee9..51f4e0a 100644 --- a/src/3rdparty/libtiff.pri +++ b/src/3rdparty/libtiff.pri @@ -32,7 +32,8 @@ SOURCES += \ $$PWD/libtiff/libtiff/tif_version.c \ $$PWD/libtiff/libtiff/tif_warning.c \ $$PWD/libtiff/libtiff/tif_write.c \ - $$PWD/libtiff/libtiff/tif_zip.c + $$PWD/libtiff/libtiff/tif_zip.c \ + $$PWD/libtiff/port/snprintf.c wince*: SOURCES += $$PWD/libtiff/libtiff/tif_win32.c win32: SOURCES += $$PWD/libtiff/libtiff/tif_win32.c diff --git a/src/3rdparty/libtiff/ChangeLog b/src/3rdparty/libtiff/ChangeLog index a537f71..5b77723 100644 --- a/src/3rdparty/libtiff/ChangeLog +++ b/src/3rdparty/libtiff/ChangeLog @@ -1,3 +1,889 @@ +2015-09-12 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff 4.0.6 released. + + * html/v4.0.6.html: Added release notes for 4.0.6. + +2015-09-06 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiffgt.c: Silence glut API deprecation warnings on MacOS + X. Patch by Roger Leigh. + + * Makefile.am: Added a 'coverity' rule to assist with Coverity + submissions. + + * tools/tiff2pdf.c: Fix compiler warning about unused function + when JPEG is not available. + + * tools/fax2ps.c (main): Detect failure to write to temporary + file. + +2015-09-05 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_dirread.c (TIFFReadDirEntryCheckRangeSlongSlong8): + Change implementation so that it does not sometimes overflow the + range of a 32-bit int and to avoid a signed vs unsigned compare + compiler warning. + (TIFF_INT64_MAX): Avoid use of platform-specific large constants. + (TIFF_UINT32_MAX): Avoid use of platform-specific large constants. + +2015-09-01 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * Makefile.am (distcheck-hook), configure.ac: Applied patches by + Roger Leigh (via tiff mailing list on 2015-09-01) to fix issue + with BSD make and to make use of cmake in 'distcheck' target + conditional on if cmake is available. + + * CMakeLists.txt, Makefile.am, configure.ac: Applied patches by + Roger Leigh (via tiff mailing list on 2015-09-01). + + CMake build is now included in 'distcheck' target. + + Builds with CMake 2.8.9 and newer. + + Tar is now resquested to use POSIX PAX format. + +2015-08-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * CMakeLists.txt, libtiff/test/Makefile.am: Applied patches by + Roger Leigh (via tiff mailing list on 2015-08-31. + + CMake reads all version information directly from configure.ac to + avoid duplication of values. This basically greps over the file + for the LIBTIFF_* variables, then translates them to the form + needed for cmake. This includes the release version and libtool + shared library version information. + + Make shared/static library building configurable. Currently it + always builds shared libraries, with static libs having a _static + suffix (copying zlib, but it means it's got a non-standard name). + CMake has a -DBUILD_SHARED_LIBS=ON|OFF option to select one or the + other, which is now used instead. There's now a single "tiff" + target to build either shared or static as required, and all the + tests and tools are linked with this. Note: the Windows tests fail + when linked with a static libtiff (says: libtiff.dll not found). + Not really a regression since this was not tested up to this + point, and it's likely the unit tests haven't (ever?) been run on + Windows with a static libtiff, so there's some additional + portability issue here to address. Works fine on UNIX systems, + and fine on Windows with the default to build a DLL. + + Add a missing file which wasn't being distributed, causing unit + tests to fail. Note that "find . -name '*.cmake'" lists all the + CMake files which need distributing in addition to all the + CMakeLists.txt files (which now are distributed). + +2015-08-31 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_predict.c: pedantic change to add explicit masking + with 0xff before casting to uchar in floating-point horizontal + differencing and accumulation routines. + +2015-08-31 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_predict.c: fix generation of output with 16 bit + or 32 bit integer, when byte swapping is needed, in + horizontal predictor (#2521). Also fixes decoding when there is + a single pixel to code (unlikely case...) and byte swapping is + involved. + +2015-08-30 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_lzw.c: make nextdata a unsigned type to avoid + undefined behaviour with shifts (gcc -fsanitize=shift) + +2015-08-30 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_fax3.c, libtiff/tif_lzw.c, libtiff/tif_predict.c: + add explicit masking with 0xff before casting + to unsigned char (make icc -check=conversions happy) + + * libtiff/tif_predict.c: operate on unsigned datatypes when + computing/applying differences to avoid undefined behaviour of + signed types (C standard compliance) + +2015-08-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * configure.ac: libtiff 4.0.5 released. + +2015-08-29 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * CMakeLists.txt: Applied patch by Roger Leigh (via tiff mailing + list on 2015-08-29) to add ld-version-script option to cmake build + to match autoconf. Note: defaults to 'on' to be ABI-compatible by + default with common Linux distribution builds. Note that the + autoconf configure script defaults to 'off'. + + * html/build.html: Applied patch by Roger Leigh (via tiff mailing + list on 2015-08-29) to describe how to use CMake to build libtiff. + +2015-08-28 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * html/v4.0.5.html: Added HTML file describing the changes which + will appear in the 4.0.5 release. + +2015-08-23 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tiffiop.h: For MinGW comiles, make sure that build + supports necessary __MSVCRT_VERSION__ (at least at least 0x800). + Otherwise large files can not be supported for POSIX-style I/O. + + * tools/fax2tiff.c (main): Eliminate a compiler warning in 64-bit + builds about cast to thandle_t. + + * test/rewrite_tag.c (main): Does not require any arguments. + +2015-08-20 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/CMakeLists.txt, port/snprintf.c: Patch by Roger Leigh to + fix build issues when using Cmake due to Windows large file + changes. + +2015-08-18 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tiffiop.h: First cut at supporting large files under + Microsoft Windows using tif_unix.c and the libtiff tools. This + only works if the Windows CDK is new enough to support the APIs + used (Visual C++ 2005 or later). Support for large files is not + actually tested yet. + +2015-08-15 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_jpeg.c: Applied patch by Räisä Olli to assure that + client_data is initialized to a known value, and to report an + error on two memory allocation failures. + +2015-08-13 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * CMakeLists.txt: Applied patch by Roger Leigh to fix libtiffxx + symbol versioning. Patch was mailed to libtiff list on Thu, 13 + Aug 2015. + +2015-07-04 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * cmake: Add d suffix to debug libraries with MSVC. Patch #3 of 3 + by Roger Leigh posted to tiff list on Wed, 1 Jul 2015 15:58:20 + +0100. + + * cmake: Add extra warning flags. Patch #2 of 3 by Roger Leigh + posted to tiff list on Wed, 1 Jul 2015 15:58:20 +0100. + + * cmake: Correct snprintf fallback for VS2015. Patch #1 of 3 by + Roger Leigh posted to tiff list on Wed, 1 Jul 2015 15:58:20 +0100. + +2015-06-24 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * CMakeLists.txt: Add CMake patchset by Roger Leigh as posted to + libtiff mailing list on Mon, 22 Jun 2015 21:21:01 +0100. Several + corrections to ensure that the autotools build still works were + added by me. I have not yet tested the build using 'cmake' or + MSVC with 'nmake'. + +2015-06-21 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * test/Makefile.am: tiff2rgba-quad-tile.jpg.sh depends on the JPEG + library so only execute if JPEG is available. + + * libtiff 4.0.4 released. + + * configure.ac: Add a HAVE_FOO Automake conditional for each + add-on library. + + * test/Makefile.am (JPEG_DEPENDENT_CHECK_PROG): raw_decode + requires JPEG support to compile. Use Automake conditional to + only include it when JPEG support is available. + + * html/build.html: Try to improve the nmake-based VC++ build + description. + + * libtiff/tiffconf.vc.h: Build fixes based on testing. + + * libtiff/tif_config.vc.h: Build fixes based on testing. + + * libtiff/libtiff.def: TIFFRasterScanline does not exist so remove + export for it. + +2015-06-20 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_config.vc.h: Make adjustments to match the new + definitions that configure produces, including for WIN64. Still + needs to be tested. + + * configure.ac: For 64-bit MinGW, fix SSIZE_FORMAT formatting + specifier. 64-bit MinGW supports 'long long' but support for + 'lld' is not assured by the run-time DLLs and so GCC warns. + Add TIFF_SIZE_T and TIFF_SIZE_FORMAT to provide a type definition + and printf format specifier to deal with printing values of + 'size_t' type. In particular, this was necessary for WIN64. + Added a configure test for if the system headers provide 'optarg' + (normal case) and block out the many explicit 'extern' statements + in the utilities. This was found to be necessary under Windows + when getopt is in a DLL and the symbols are already imported with + dllimport via standard header files. + + * test/raw_decode.c (XMD_H): Avoid conflicting typedefs for INT32 + and boolean in MinGW build due to including jpeglib.h. + + * test/rewrite_tag.c (main): Fix problem with location of variable + declaration. + + * libtiff/libtiff.def: Added exports for TIFFGetConfiguredCODECs, + TIFFReadRGBAImageOriented, TIFFSetCompressionScheme, + TIFFSwabArrayOfTriples, TIFFVGetFieldDefaulted, _TIFFCheckRealloc, + TIFFRasterScanline, TIFFSetErrorHandlerExt, + TIFFSetWarningHandlerExt, TIFFNumberOfDirectories, + TIFFCreateCustomDirectory, TIFFCreateEXIFDirectory, + TIFFWriteCustomDirectory, _TIFFRewriteField as recommended by + Roger Leigh and justified by use in libtiff tests, documentation, + and changelog notes. Also sorted symbol list and removed + duplicate entries. + +2015-06-16 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_getimage.c: Fix four Coverity issues related to + unintended sign extension. + +2015-06-16 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_unix.c: fix compilation with MSVC (fix by Jeff McKenna) + +2015-06-14 Lee Howard <faxguy@howardsilvan.com> + + * libtiff/tif_unix.c: contribution from Vadim Zeitlin on + Bugzilla Bug #2510 fixes several harmless but still annoying + warnings + + * configure: contribution from Ludolf Holzheid on Bugzilla + Bug #2498. Adds an option to select the file I/O style on + Windows hosts. + + * libtiff/tif_getimage.c: contribution from Gary Cramblitt + on Bugzilla Bug #2409. Correct reading of certain tiled TIFFs. + + * configure, configure.ac: contribution from Marcos H. Woehrmann + on Bugzilla Bug #2405. Correct shell equality operator. + + * tools/tiffgt.c (raster_draw): contribution from Jay Berkenbilt + on Bugzilla Bug #2401. Appropriately call glFlush(). + + * tools/tiff2pdf.c: change ColorTransform from "0" to "1" + following Bugzilla Bug #2150. + +2015-06-13 Lee Howard <faxguy@howardsilvan.com> + + * libtiff/tif_lzw.c: contribution from Andy Cave - decode + files that contain consecutive CODE_CLEAR codes. + + * tools/tiff2pdf.c: contribution from Antti S. Lankila on + Bugzilla Bug #2078. Suppress initial output of the header. + + * tools/tiff2pdf.c: contribution from Yuriy M. Kaminskiy - + Take care in using the return value from snprintf(). + + * tools/tiffcrop.c: contribution from Eduardo Robles Elvira - + correctly copy the compression tag from the source TIFF. + + * tools/tiff2ps.c: contribution from Eduardo Robles Elvira - + correct sizing and scaling problems with output document. + +2015-06-10 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_jpeg.c (JPEGDecode): Split JPEGDecode() into two + clean implementations in order to avoid pre-processor hell. Only + one of the implementations is used in a given build. + +2015-06-08 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_jpeg.c: Fix compilation in BITS_IN_JSAMPLE == 12 + case + +2015-06-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_write.c (TIFFWriteEncodedStrip): Fix Coverity 715975 + "Division or modulo by zero". + (TIFFWriteEncodedTile): Fix Coverity 715976 and 715977 "Division + or modulo by zero". + (TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo by + zero". + (TIFFWriteScanline): Fix Coverity 715979 "Division or modulo by + zero". + + * libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973 and + 715974 "Division or modulo by zero". + +2015-05-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_dir.c (TIFFNumberOfDirectories): Quiet Coverity + 1134470 "Logically dead code" by making the roll-over check + explicit. + + * libtiff/tif_luv.c (LogLuvDecodeTile): Fix Coverity 991227 + "Division or modulo by zero". + (LogLuvDecodeStrip): Fix Coverity 991239 "Division or modulo by + zero". + (LogLuvEncodeStrip): Fix Coverity 991240 "Division or modulo by + zero". + (LogLuvEncodeTile): Fix Coverity 991241 "Division or modulo by + zero". + + * libtiff/tif_dirread.c (TIFFReadDirEntryDoubleArray): Fix + Coverity 298626 "Logically dead code". + (TIFFReadDirEntryFloatArray): Fix Coverity 298627 "Logically dead + code". + (TIFFReadDirEntryIfd8Array): Fix Coverity 298628 "Logically dead + code". + (TIFFReadDirEntrySlong8Array): Fix Coverity 298629 "Logically dead + code" + + * libtiff/tif_dir.c (TIFFNumberOfDirectories): Don't depend on ++ + operator precedenc in evaluation. Might quench Coverity 1134470 + "Logically dead code". + + * libtiff/tif_jpeg.c (JPEGDecode): Fix Coverity 602597 "Operands + don't affect result". This change uses ifdefs to include + applicable code based on properties of libjpeg. Still needs to be + re-tested with 12-bit "6b" and "MK1". + +2015-05-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_dirwrite.c (_TIFFRewriteField): Fix Coverity 1024310 + "Resource leak". + + * libtiff/tif_ojpeg.c (OJPEGReadHeaderInfoSecStreamDht): Fix + Coverity 601720 "Resource leak". + + * libtiff/tif_jpeg.c (JPEGCleanup): Fix Coverity 298624 + "Dereference before null check". + + * libtiff/tif_ojpeg.c (OJPEGReadBufferFill): Fix Coverity 603400 + "Missing break in switch". + + * contrib/addtiffo/tif_overview.c (TIFF_DownSample): Check buffer + size calculation for overflow. + + * contrib/addtiffo/addtiffo.c (main): Possibly address Coverity + 1024226 "Untrusted value as argument". + + * tools/gif2tiff.c (readgifimage): Fix Coverity 1024222 "Untrusted + value as argument". + (checksignature): Fix Coverity 1024894 "Ignoring number of bytes + read". + (readextension): Fix Coverity 1024893 "Ignoring number of bytes + read". + (readgifimage): Fix Coverity 1024890 "Ignoring number of bytes + read". + (readraster): Fix Coverity 1024891 "Ignoring number of bytes + read". + (readgifimage): Fix Coverity 1024892 "Ignoring number of bytes + read". + + * tools/tiff2pdf.c (t2p_readwrite_pdf_image): Fix Coverity 1024181 + "Structurally dead code". + + * tools/raw2tiff.c (main): Fix Coverity 1024887 "Unchecked return + value from library". + (guessSize): Fix Coverity 1024888 "Unchecked return value from + library". + (guessSize): Fix Coverity 1214162 "Ignoring number of bytes read". + (guessSize): Fix Coverity 1024889 "Unchecked return value from + library". + + * tools/tiff2pdf.c (t2p_readwrite_pdf_image): Fix Coverity 298621 + "Resource leak". + (t2p_readwrite_pdf_image): Fix Coverity 1024181 "Structurally dead + code". + (t2p_write_pdf): Fix Coverity 1227690 "Unused value". + +2015-05-29 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * contrib/iptcutil/iptcutil.c (formatIPTC): Fix Coverity 1024468 + "Infinite loop". + (formatIPTC): Fix Coverity 1024727 "Truncated stdio return value". + (formatIPTC): Fix Coverity 1214240 "Untrusted loop bound". + +2015-05-28 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * contrib/addtiffo/tif_ovrcache.c (TIFFCreateOvrCache): Fix + Coverity 298615 "Resource leak". + (TIFFGetOvrBlock): Fix Coverity 1024649 "Unintended sign + extension". + + * tools/bmp2tiff.c (main): Fix Coverity 1024225 "Untrusted value + as argument". + (main): Fix Coverity 1024678 "Unchecked return value from + library". + (main): Fix Coverity 1024679 "Unchecked return value from + library". + (main): Fix Coverity 1214160 "Ignoring number of bytes read". + + * contrib/addtiffo/tif_ovrcache.c (TIFFCreateOvrCache): Fix + Coverity 298615 "Resource leak". + + * tools/tiffcp.c: Fix Coverity 1024306, 1024307, 1024308, 1024309 + "Resource leak". + + * tools/tiffsplit.c (cpTiles): Fix Coverity 1024304 "Resource + leak". + (cpStrips): Fix Coverity 1024305 "Resource leak". + +2015-05-27 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/ras2tiff.c: Fix Sun Raster header definition to be safe + for 64-bit systems. Add some header validations. Should fix many + Coverity issues. + (main): Fix Coverity 1301206: "Integer handling issues (BAD_SHIFT)". + (main): Quiet Coverity 1024223 "Untrusted value as argument". + + * tools/tiffmedian.c (GetInputLine): Fix Coverity 1024795 "Nesting + level does not match indentation". + (get_histogram): Quiet Coverity 1024386 "Out-of-bounds read". + This was a benign mis-diagnosis but added code to enforce against + buffer overflow. + + * tools/tiffcrop.c (ROTATE_ANY): Fix Coverity 1294542 "Logical + vs. bitwise operator". + (readContigStripsIntoBuffer): Fix Coverity 1024545 "Division or + modulo by zero". + (readContigTilesIntoBuffer): Fix Coverity 1024586 "Logically dead + code". + (writeSingleSection): Fix Coverity 1024796 "Nesting level does not + match indentation". + (writeCroppedImage): Fix Coverity 1024797 "Nesting level does not + match indentation". + (loadImage): Fix Coverity 1299741 "Dereference before null check". + (loadImage): Fix Coverity 1299740 "Out-of-bounds write". + +2015-03-02 Even Rouault <even.rouault@spatialys.com> + + * tools/tiffdither.c: check memory allocations to avoid writing to + NULL pointer. Also check multiplication overflow. Fixes #2501, + CVE-2014-8128. Derived from patch by Petr Gajdos. + +2015-01-26 Even Rouault <even.rouault@spatialys.com> + + * add html/v4.0.4beta.html under version control + * HOWTO-RELEASE: write that cvs add html/vX.X.html must be used + +2015-01-26 Even Rouault <even.rouault@spatialys.com> + + * libtiff 4.0.4beta released + +2015-01-26 Even Rouault <even.rouault@spatialys.com> + + * automake: updated to 1.15 + * libtool: updated to 2.4.5 + +2015-01-22 Even Rouault <even.rouault@spatialys.com> + + * tools/tiff2pdf.c: Fix two crashes (oCERT-2014-013) + +2015-01-05 Frank Warmerdam <warmerdam@pobox.com> + + * html/bugs.html: remove note about needing to email the tiff mailing + list administrator about being approved for membership, this appears + not to be true. + +2015-01-05 Olivier Paquet <olivier.paquet@gmail.com> + + * tools/tiff2pdf.c: Fixed unsigned integer addition overflow detection. + +2015-01-03 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_dirread.c: in TIFFCheckDirOffset(), avoid uint16 overflow + when reading more than 65535 directories, and effectively error out when + reaching that limit. + +2014-12-29 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_jpeg.c: in JPEGFixupTags(), recognize SOF2, SOF9 and SOF10 + markers to avoid emitting a warning (even if, according to the TechNote, + there are admitedly unusual/not recommended or even forbidden variants, but + they do work well with libjpeg for SOF2, and with libjpeg-turbo for SOF2, + SOF9 and SOF10). + Define in_color_space and input_components to the right values in + JPEGSetupEncode(), before calling jpeg_set_defaults(), as specified by + libjpeg API documentation, so as to be compatible with mozjpeg library. + Note: the default settings of mozjpeg will produce progressive scans, which + is forbidden by the TechNote. + +2014-12-29 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_getimage.c: move test on vertical value of YCbCr subsampling. + to avoid buffer leak (fix previous fix, found by Coverity scan) + +2014-12-29 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_next.c: add new tests to check that we don't read outside of + the compressed input stream buffer. + + * libtiff/tif_getimage.c: in OJPEG case, fix checks on strile width/height + in the putcontig8bitYCbCr42tile, putcontig8bitYCbCr41tile and + putcontig8bitYCbCr21tile cases. + +2014-12-27 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_dir.c: in TIFFDefaultDirectory(), reset any already existing + extented tags installed by user code through the extender mechaninm before + calling the extender callback (GDAL #5054) + +2014-12-26 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiffcrop.c: Fix warnings about variables set but not used. + + * contrib/iptcutil/iptcutil.c: Fix warnings about variables set + but not used. + + * tools/tiffgt.c: Fix warnings about unused parameters. + + * libtiff/tif_stream.cxx: Fix warnings about unused parameters. + +2014-12-25 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_getimage.c, libtiff/tif_ojpeg.c, libtiff/tif_zip.c: fix + various typos found by Debian lintian tool (GDAL #5756) + +2014-12-24 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_getimage.c: avoid divide by zero on invalid YCbCr subsampling. + http://bugzilla.maptools.org/show_bug.cgi?id=2235 + +2014-12-24 Even Rouault <even.rouault@spatialys.com> + + * tools/tiff2pdf.c: fix buffer overflow on some YCbCr JPEG compressed images. + http://bugzilla.maptools.org/show_bug.cgi?id=2445 + +2014-12-24 Even Rouault <even.rouault@spatialys.com> + + * tools/tiff2pdf.c: fix buffer overflow on YCbCr JPEG compressed image. + Derived from patch by Petr Gajdos, + http://bugzilla.maptools.org/show_bug.cgi?id=2443 + +2014-12-23 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_dirread.c: In EstimateStripByteCounts(), check return code + of _TIFFFillStriles(). This solves crashing bug on corrupted + images generated by afl. + +2014-12-23 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_read.c: fix several invalid comparisons of a uint64 value with + <= 0 by casting it to int64 first. This solves crashing bug on corrupted + images generated by afl. + +2014-12-21 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiffdump.c: Guard against arithmetic overflow when + calculating allocation buffer sizes. + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * tools/tiff2bw.c: when Photometric=RGB, the utility only works if + SamplesPerPixel = 3. Enforce that + http://bugzilla.maptools.org/show_bug.cgi?id=2485 (CVE-2014-8127) + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * tools/pal2rgb.c, tools/thumbnail.c: fix crash by disabling TIFFTAG_INKNAMES + copying. The right fix would be to properly copy it, but not worth the burden + for those esoteric utilities. + http://bugzilla.maptools.org/show_bug.cgi?id=2484 (CVE-2014-8127) + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * tools/thumbnail.c: fix out-of-buffer write + http://bugzilla.maptools.org/show_bug.cgi?id=2489 (CVE-2014-8128) + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * tools/thumbnail.c, tools/tiffcmp.c: only read/write TIFFTAG_GROUP3OPTIONS + or TIFFTAG_GROUP4OPTIONS if compression is COMPRESSION_CCITTFAX3 or + COMPRESSION_CCITTFAX4 + http://bugzilla.maptools.org/show_bug.cgi?id=2493 (CVE-2014-8128) + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_next.c: check that BitsPerSample = 2. Fixes + http://bugzilla.maptools.org/show_bug.cgi?id=2487 (CVE-2014-8129) + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * tools/tiff2pdf.c: check return code of TIFFGetField() when reading + TIFFTAG_SAMPLESPERPIXEL + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + * tools/tiffcp.c: fix crash when converting YCbCr JPEG-compressed to none. + Based on patch by Tomasz Buchert (http://bugzilla.maptools.org/show_bug.cgi?id=2480) + Description: fix for Debian bug #741451 + tiffcp crashes when converting JPEG-encoded TIFF to a different + encoding (like none or lzw). For example this will probably fail: + tiffcp -c none jpeg_encoded_file.tif output.tif + The reason is that when the input file contains JPEG data, + the tiffcp code forces conversion to RGB space. However, + the output normally inherits YCbCr subsampling parameters + from the input, which leads to a smaller working buffer + than necessary. The buffer is subsequently overrun inside + cpStripToTile() (called from writeBufferToContigTiles). + Note that the resulting TIFF file would be scrambled even + if tiffcp wouldn't crash, since the output file would contain + RGB data intepreted as subsampled YCbCr values. + This patch fixes the problem by forcing RGB space on the output + TIF if the input is JPEG-encoded and output is *not* JPEG-encoded. + Author: Tomasz Buchert <tomasz.buchert@inria.fr> + +2014-12-21 Even Rouault <even.rouault@spatialys.com> + + Fix various crasher bugs on fuzzed images. + * libtiff/tif_dir.c: TIFFSetField(): refuse to set negative values for + TIFFTAG_XRESOLUTION and TIFFTAG_YRESOLUTION that cause asserts when writing + the directory + * libtiff/tif_dirread.c: TIFFReadDirectory(): refuse to read ColorMap or + TransferFunction if BitsPerSample has not yet been read, otherwise reading + it later will cause user code to crash if BitsPerSample > 1 + * libtiff/tif_getimage.c: TIFFRGBAImageOK(): return FALSE if LOGLUV with + SamplesPerPixel != 3, or if CIELAB with SamplesPerPixel != 3 or BitsPerSample != 8 + * libtiff/tif_next.c: in the "run mode", use tilewidth for tiled images + instead of imagewidth to avoid crash + * tools/bmp2tiff.c: fix crash due to int overflow related to input BMP dimensions + * tools/tiff2pdf.c: fix crash due to invalid tile count (should likely be checked by + libtiff too). Detect invalid settings of BitsPerSample/SamplesPerPixel for CIELAB / ITULAB + * tools/tiffcrop.c: fix crash due to invalid TileWidth/TileHeight + * tools/tiffdump.c: fix crash due to overflow of entry count. + +2014-12-15 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_jpeg.c: Fix regression introduced on 2010-05-07 that caused + all tiles/strips to include quantization tables even when the jpegtablesmode + had the JPEGTABLESMODE_QUANT bit set. + Also add explicit removal of Huffman tables when jpegtablesmode has the + JPEGTABLESMODE_HUFF bit set, which avoids Huffman tables to be emitted in the + first tile/strip (only useful in update scenarios. create-only was + fine) + +2014-12-09 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiff2pdf.c: Assure that memory size calculations for + _TIFFmalloc() do not overflow the range of tmsize_t. + +2014-12-07 Even Rouault <even.rouault@spatialys.com> + + * tools/thumbnail.c, tools/tiffcrop.c: "fix" heap read over-run found with + Valgrind and Address Sanitizer on test suite + +2014-12-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiff2pdf.c (t2p_read_tiff_init): TIFFTAG_TRANSFERFUNCTION + tag can return one channel, with the other two channels set to + NULL. The tiff2pdf code was expecting that other two channels + were duplicate pointers in the case where there is only one + channel. Detect this condition in order to avoid a crash, and + presumably perform correctly with just one channel. + +2014-12-06 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiffdump.c: Fix double-free bug. + +2014-11-27 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_config.vc.h: no longer use "#define snprintf _snprintf" with + Visual Studio 2015 aka VC 14 aka MSVC 1900 + +2014-11-20 Even Rouault <even.rouault@spatialys.com> + + * libtiff/tif_lzw.c: prevent potential null dereference of + sp->dec_codetab in LZWPreDecode (bug #2459) + + * libtiff/tif_read.c: in TIFFReadBufferSetup(), avoid passing -1 size + to TIFFmalloc() if passed user buffer size is 0 (bug #2459) + + * libtiff/tif_ojpeg.c: make Coverity happier (not a bug, #2459) + + * libtiff/tif_dir.c: in _TIFFVGetField() and _TIFFVSetField(), make + Coverity happier (not a bug, #2459) + + * libtiff/tif_dirread.c: in TIFFFetchNormalTag(), make Coverity happier + (not a bug, #2459) + + * tools/tiff2pdf.c: close PDF file (bug #2479) + + * tools/fax2ps.c: check malloc()/realloc() result (bug #2470) + + * tools/tiffdump.c: detect cycle in TIFF directory chaining (bug #2463) + and avoid passing a NULL pointer to read() if seek() failed before (bug #2459) + + * tools/tiffcrop.c: fix segfault if bad value passed to -Z option + (bug #2459) and add missing va_end in dump_info (#2459) + + * tools/gif2tif.c: apply patch for CVE-2013-4243 (#2451) + +2014-11-20 Even Rouault <even.rouault@spatialys.com> + * libtiff/tif_jpeg.c: fix segfault in JPEGFixupTagsSubsampling() on + corrupted image where tif->tif_dir.td_stripoffset == NULL (bug #2471) + +2014-11-20 Even Rouault <even.rouault@spatialys.com> + * automake: updated to 1.14.1 + * libtool: updated to 2.4.3 + * HOWTO-RELEASE: small update about autotools building order + +2014-10-20 Olivier Paquet <olivier.paquet@gmail.com> + * tools/tiff2pdf.c: Preserve input file directory order when pages + are tagged with the same page number. + +2014-08-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_dirread.c (TIFFReadDirEntryOutputErr): Incorrect + count for tag should be a warning rather than an error since + errors terminate processing. + +2014-06-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiff2rgba.c (]): Fixed tiff2rgba usage message in that zip + was wrongly described. Fix suggested by Miguel Medalha. + +2014-05-06 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_dirinfo.c (TIFFField) : Fix data type for + TIFFTAG_GLOBALPARAMETERSIFD tag. Patch by Steve Underwood. + Reviewed and forwarded by Lee Howard. + +2013-11-30 Frank Warmerdam <warmerdam@pobox.com> + + * libtiff/tif_dir.c: fix last fix for TIFFNumberOfDirectories() + +2013-10-21 Frank Warmerdam <warmerdam@pobox.com> + + * libtiff/tif_dir.c: generate error in case of directory count + overflow. + +2013-10-01 Frank Warmerdam <warmerdam@pobox.com> + + * libtiff/tiff.h, libtiff/tif_dirinfo.c: add definitions for + TIFF/EP CFARepeatPatternDim and CFAPattern tags (bug #2457) + +2013-09-12 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * libtiff/tif_dir.c (TIFFAdvanceDirectory): If nextdir is found to + be defective, then set it to zero before returning error in order + to terminate processing of truncated TIFF. Issue found and fix + suggested by Richard Nolde. + +2013-08-14 Frank Warmerdam <warmerdam@pobox.com> + + * tools/gif2tiff.c: fix possible OOB write (#2452, CVE-2013-4244) + +2013-08-13 Frank Warmerdam <warmerdam@pobox.com> + + * tools/gif2tiff.c: Be more careful about corrupt or + hostile input files (#2450, CVE-2013-4231) + + * tools/tiff2pdf.c: terminate after failure of allocating + ycbcr buffer (bug #2449, CVE-2013-4232) + +2013-07-09 Frank Warmerdam <warmerdam@google.com> + + * tools/tiffinfo.c: Default various values fetched with + TIFFGetField() to avoid being uninitialized. + +2013-05-02 Tom Lane <tgl@sss.pgh.pa.us> + + * tools/tiff2pdf.c: Rewrite JPEG marker parsing in + t2p_process_jpeg_strip to be at least marginally competent. The + approach is still fundamentally flawed, but at least now it won't + stomp all over memory when given bogus input. Fixes CVE-2013-1960. + +2013-05-02 Tom Lane <tgl@sss.pgh.pa.us> + + * contrib/dbs/xtiff/xtiff.c, libtiff/tif_codec.c, + libtiff/tif_dirinfo.c, tools/rgb2ycbcr.c, tools/tiff2bw.c, + tools/tiff2pdf.c, tools/tiff2ps.c, tools/tiffcrop.c, + tools/tiffdither.c: Enlarge some fixed-size buffers that weren't + large enough, and eliminate substantially all uses of sprintf(buf, + ...) in favor of using snprintf(buf, sizeof(buf), ...), so as to + protect against overflow of fixed-size buffers. This responds in + particular to CVE-2013-1961 concerning overflow in tiff2pdf.c's + t2p_write_pdf_page(), but in general it seems like a good idea to + deprecate use of sprintf(). + +2013-03-29 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * configure.ac: Applied patch by Brad Smith to improve pkg-config + static linking by adding -lm to Libs.private when needed. + +2013-03-05 Tom Lane <tgl@sss.pgh.pa.us> + + * html/man/tiff2ps.1.html, html/man/tiffcp.1.html, + html/man/tiffdither.1.html, man/tiff2ps.1, man/tiffcp.1, + man/tiffdither.1, tools/tiff2ps.c, tools/tiffcp.c, + tools/tiffdither.c: Sync tool usage printouts and man pages with + reality (quite a few options had escaped being documented in one + or both places). Per an old report from Miroslav Vadkerti. + +2013-01-25 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiff2ps.c:Fix bug in auto rotate option code. Once a + rotation angle was set by the auto rotate check, it was retained + for all pages that followed instead ofa being retested for each + page. Patch by Richard Nolde. + +2013-01-18 Frank Warmerdam <warmerdam@google.com> + + * libtiff/tif_write.c: tmsize_t related casting warning fixed for + 64bit linux. + + * libtiff/tif_read.c: uint64/tmsize_t change for MSVC warnings. + http://bugzilla.maptools.org/show_bug.cgi?id=2427 + +2012-12-20 Tom Lane <tgl@sss.pgh.pa.us> + + * test/raw_decode.c: Relax raw_decode's pixel-value checks so that + it will pass with more versions of libjpeg. (There are at least + three in active use now, and JPEG_LIB_VERSION doesn't tell us + enough to uniquely identify expected results.) + +2012-12-12 Tom Lane <tgl@sss.pgh.pa.us> + + * libtiff/tif_print.c: Fix TIFFPrintDirectory's handling of + field_passcount fields: it had the TIFF_VARIABLE and + TIFF_VARIABLE2 cases backwards. + +2012-12-10 Tom Lane <tgl@sss.pgh.pa.us> + + * tools/ppm2tiff.c: Improve previous patch for CVE-2012-4564: + check the linebytes calculation too, get the max() calculation + straight, avoid redundant error messages, check for malloc + failure. + +2012-12-10 Tom Lane <tgl@sss.pgh.pa.us> + + * libtiff/tif_pixarlog.c: Improve previous patch for CVE-2012-4447 + (to enlarge tbuf for possible partial stride at end) so that + overflow in the integer addition is detected. Per gripe from + Huzaifa Sidhpurwala. + +2012-12-03 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * tools/tiffset.c: tiffset now supports a -u option to unset a + tag. Patch by Zach Baker. See + http://bugzilla.maptools.org/show_bug.cgi?id=2419 + +2012-11-18 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> + + * automake: Update Automake to 1.12.5 release. + + * libtiff/tif_{unix,vms,win32}.c (_TIFFmalloc): ANSI C does not + require malloc() to return NULL pointer if requested allocation + size is zero. Assure that _TIFFmalloc does. + +2012-11-01 Frank Warmerdam <warmerdam@pobox.com> + + * tools/ppm2tiff.c: avoid zero size buffer vulnerability. + CVE-2012-4564 - Thanks to Huzaifa Sidhpurwala of the + Red Hat Security Response team for the fix. + +2012-10-18 Frank Warmerdam <warmerdam@google.com> + + * tif_zip.c: Avoid crash on NULL error messages. + 2012-09-22 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> * libtiff 4.0.3 released. @@ -24,7 +910,7 @@ 2012-08-02 Frank Warmerdam <warmerdam@google.com> - * libtiff/tif_dirread.c: report error in case of mismatch value + * libtiff/tif_dirread.c: report error in case of mismatch value counts for tags (ie. DotRange). 2012-07-26 Tom Lane <tgl@sss.pgh.pa.us> @@ -78,7 +964,7 @@ 2012-06-19 Frank Warmerdam <warmerdam@google.com> - * libtiff/tif_packbits.c: fix read past end of data buffer. + * libtiff/tif_packbits.c: fix read past end of data buffer. 2012-06-15 Frank Warmerdam <warmerdam@google.com> @@ -118,7 +1004,7 @@ * libtiff/tif_dir.c, tif_print.c : Remove FIELD_CUSTOM handling for PAGENUMBER, HALFTONEHINTS, and YCBCRSUBSAMPLING. Implement DOTRANGE - differently. This is to avoid using special TIFFGetField/TIFFSetField + differently. This is to avoid using special TIFFGetField/TIFFSetField rules for these fields in non-image directories (like EXIF). 2012-06-04 Frank Warmerdam <warmerdam@google.com> @@ -214,7 +1100,7 @@ 2012-01-31 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_dir.c, libtiff/tif_dirread.c: Extra caution around - assumption tag fetching is always successful. + assumption tag fetching is always successful. * libtiff/tif_jpeg.c: Extra caution for case where sp is NULL. @@ -250,7 +1136,7 @@ * libtiff/tif_dirread.c: fixes to deal with invalid files where _TIFFFillStriles() fails, and we try to chop up strips (gdal #4372) - * libtiff/tif_dirread.c: fix error reporting when there is no + * libtiff/tif_dirread.c: fix error reporting when there is no tag information struct and name (gdal #4373) 2011-10-22 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -295,11 +1181,11 @@ 2011-04-20 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_dirinfo.c,tiffio.h: Remove the obsolete - TIFFMergeFieldInfo/TIFFFindFieldInfo/TIFFFindFieldInfoByName API. + * libtiff/tif_dirinfo.c,tiffio.h: Remove the obsolete + TIFFMergeFieldInfo/TIFFFindFieldInfo/TIFFFindFieldInfoByName API. http://bugzilla.maptools.org/show_bug.cgi?id=2315 - * libtiff/libtiff.def: add some missing (64bit) APIs. + * libtiff/libtiff.def: add some missing (64bit) APIs. http://bugzilla.maptools.org/show_bug.cgi?id=2316 2011-04-09 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -342,8 +1228,8 @@ 2011-03-21 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_thunder.c: Correct potential buffer overflow with - thunder encoded files with wrong bitspersample set. The libtiff + * libtiff/tif_thunder.c: Correct potential buffer overflow with + thunder encoded files with wrong bitspersample set. The libtiff development team would like to thank Marin Barbella and TippingPoint's Zero Day Initiative for reporting this vulnerability (ZDI-CAN-1004, CVE-2011-1167). @@ -351,25 +1237,25 @@ 2011-03-10 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_fax3.h: Fix to last change allowing zero length + * libtiff/tif_fax3.h: Fix to last change allowing zero length runs at the start of a scanline - needed for legal cases. 2011-03-02 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_fax3.h: Protect against a fax VL(n) codeword commanding - a move left. Without this, a malicious input file can generate an - indefinitely large series of runs without a0 ever reaching the right + * libtiff/tif_fax3.h: Protect against a fax VL(n) codeword commanding + a move left. Without this, a malicious input file can generate an + indefinitely large series of runs without a0 ever reaching the right margin, thus overrunning our buffer of run lengths. Per CVE-2011-0192. - This is a modified version of a patch proposed by Drew Yao of Apple - Product Security. It adds an unexpected() report, and disallows the - equality case, since emitting a run without increasing a0 still allows + This is a modified version of a patch proposed by Drew Yao of Apple + Product Security. It adds an unexpected() report, and disallows the + equality case, since emitting a run without increasing a0 still allows buffer overrun. 2011-02-23 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_jpeg.c: avoid divide by zero in degenerate case (#2296) - * tools/tiff2rgba.c: close source file on error to make leak + * tools/tiff2rgba.c: close source file on error to make leak detection easier. * libtiff/tif_getimage.c: avoid leaks if TIFFRGBAImageBegin() fails. @@ -384,15 +1270,15 @@ 2011-02-18 Frank Warmerdam <warmerdam@pobox.com> * configure.ac, configure: Added support for --enable-chunky-strip-read - configure option to enable the experimental feature from a couple - months ago for reading big strips in chunks. + configure option to enable the experimental feature from a couple + months ago for reading big strips in chunks. - * configure.ac, tif_read.c, tif_readdir.c, tif_dir.h, tiffiop.h, + * configure.ac, tif_read.c, tif_readdir.c, tif_dir.h, tiffiop.h, tif_write.c, tif_print.c, tif_jpeg.c, tif_dirwrite.c, tif_write.c: - Implement optional support for deferring the load of strip/tile + Implement optional support for deferring the load of strip/tile offset and size tags for optimized scanning of directories. Enabled with the --enable-defer-strile-load configure option (DEFER_STRILE_LOAD - #define in tif_config.h). + #define in tif_config.h). 2011-02-11 Frank Warmerdam <warmerdam@pobox.com> @@ -401,7 +1287,7 @@ 2011-02-09 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_win32.c: avoid error/warning buffer overrun problem - with non-console (popup message) builds on win32. + with non-console (popup message) builds on win32. http://bugzilla.maptools.org/show_bug.cgi?id=2293 @@ -417,18 +1303,18 @@ 2011-01-06 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_pixarlog.c: Note that tif_rawcc/tif_rawcp are not - maintained. + * libtiff/tif_pixarlog.c: Note that tif_rawcc/tif_rawcp are not + maintained. - * libtiff/tif_zip.c: Maintain tif_rawcc/tif_rawcp when decoding + * libtiff/tif_zip.c: Maintain tif_rawcc/tif_rawcp when decoding for CHUNKY_STRIP_READ_SUPPORT. * libtiff/tif_jpeg.c: ensure that rawcc and rawcp are maintained - during JPEGPreDecode and JPEGDecode calls. - * libtiff/tif_read.c: larger read ahead for CHUNKY_STRIP_READ_SUPPORT, - as compression formats like JPEG keep 16 lines interleaved in a sense - and might need to touch quite a bit of data. - + during JPEGPreDecode and JPEGDecode calls. + * libtiff/tif_read.c: larger read ahead for CHUNKY_STRIP_READ_SUPPORT, + as compression formats like JPEG keep 16 lines interleaved in a sense + and might need to touch quite a bit of data. + http://trac.osgeo.org/gdal/ticket/3894 2011-01-03 Lee Howard <faxguy@howardsilvan.com> @@ -510,7 +1396,7 @@ 2010-12-12 Lee Howard <faxguy@howardsilvan.com> - * tools/tiff2pdf.c: fix colors for images with RGBA + * tools/tiff2pdf.c: fix colors for images with RGBA interleaved data http://bugzilla.maptools.org/show_bug.cgi?id=2250 @@ -591,7 +1477,7 @@ 2010-10-21 Frank Warmerdam <warmerdam@pobox.com> * tools/tiffinfo.c: avoid direct reference to _TIFFerrorHandler. - + * libtiff/tif_config.vc.h: define snprintf to _snprintf for tiff2pdf. * libtiff/libtiff.def: export _TIFFCheckMalloc for tools. @@ -692,11 +1578,11 @@ * libtiff/tif_dirinfo.c: Fix invocation of tag compare function (#2201) - * tools/tiff2pdf.c: Fix assorted bugs in tiff2pdf: missing "return" - in t2p_read_tiff_size() causes t2p->tiff_datasize to be set entirely - wrong for COMPRESSION_JPEG case, resulting in memory stomp if actual - size is larger. Also, there are a bunch of places that try to - memset() a malloc'd buffer before checking for malloc failure, which + * tools/tiff2pdf.c: Fix assorted bugs in tiff2pdf: missing "return" + in t2p_read_tiff_size() causes t2p->tiff_datasize to be set entirely + wrong for COMPRESSION_JPEG case, resulting in memory stomp if actual + size is larger. Also, there are a bunch of places that try to + memset() a malloc'd buffer before checking for malloc failure, which would result in core dump if there actually were a failure. (#2211) 2010-06-11 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -772,13 +1658,13 @@ 2010-05-07 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: Ensure that quality is always set in - JPEGPreEncode(), not just when we want to output local tables. + * libtiff/tif_jpeg.c: Ensure that quality is always set in + JPEGPreEncode(), not just when we want to output local tables. Otherwise the quality used during compression may not be right and might not match the tables in the tables tag. This bug only occurs when seeking between directories in the midst of writing blocks. http://trac.osgeo.org/gdal/ticket/3539 - + 2010-05-06 Andrey Kiselev <dron@ak4719.spb.edu> * html/man/TIFFGetField.3tiff.html, html/man/TIFFSetField.3tiff.html: @@ -801,9 +1687,9 @@ 2010-04-21 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: avoid preparing jpeg tables everytime - JPEGSetupEncode() is called if the tables already seem to be - established. This prevents spurious updates and rewriting of + * libtiff/tif_jpeg.c: avoid preparing jpeg tables everytime + JPEGSetupEncode() is called if the tables already seem to be + established. This prevents spurious updates and rewriting of directories with jpegtables when doing updates to existing images. http://trac.osgeo.org/gdal/ticket/3539 @@ -828,7 +1714,7 @@ 2010-04-02 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_read.c (primarily): Add support for + * libtiff/tif_read.c (primarily): Add support for CHUNKY_STRIP_READ_SUPPORT where large strips are read in chunks for applications using TIFFReadScanline(). This is intended to make it more practical work with very @@ -857,11 +1743,11 @@ 2010-02-22 Lee Howard <faxguy@howardsilvan.com> * libtiff/tif_jpeg.c: Do not generate a JPEGTables tag when creating - the JPEG TIFF as is is not required in order to prevent it from - being unused and filled with invalid data. (Leave it to be + the JPEG TIFF as is is not required in order to prevent it from + being unused and filled with invalid data. (Leave it to be generated by later activity.) http://bugzilla.maptools.org/show_bug.cgi?id=2135 - * tools/tiff2pdf.c: Write the JPEG SOI headers into the TIFF strip + * tools/tiff2pdf.c: Write the JPEG SOI headers into the TIFF strip data rather than skipping them. This fixes the ability to view in Acrobat Reader, Evince, and Ghostscript. http://bugzilla.maptools.org/show_bug.cgi?id=2135 @@ -872,7 +1758,7 @@ 2009-12-03 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_jpeg.c: Made JPEGDecodeRaw() check for buffer overruns. - Made so that when working with downsampled images a stub function + Made so that when working with downsampled images a stub function reporting an error is used for tif_decoderow. We cannot meaningfully support reading scanlines in this situation. (#1936) @@ -882,17 +1768,17 @@ 2009-11-30 Frank Warmerdam <warmerdam@pobox.com> - * contrib/dbs/tiff-grayscale.c, contrib/tif-palette.c, + * contrib/dbs/tiff-grayscale.c, contrib/tif-palette.c, tools/ras2tiff.c: Fix resource leaks on error. http://bugzilla.maptools.org/show_bug.cgi?id=2121 - * libtiff/tif_{aux.c,dir.c,dir.h,dirinfo.c}: Return to handling + * libtiff/tif_{aux.c,dir.c,dir.h,dirinfo.c}: Return to handling TIFFTAG_REFERENCEBLACKWHITE as a field in the TIFF directory instead of as a custom(generic) field to avoid a potential reentrancy problem. http://bugzilla.maptools.org/show_bug.cgi?id=2125 - + * libtiff/tif_color.c, libtiff/tif_getimage.c, libtiff/tiffio.h, - man/TIFFcolor.3tiff: Make TIFFDisplay argument in TIFFCIELabToRGBInit + man/TIFFcolor.3tiff: Make TIFFDisplay argument in TIFFCIELabToRGBInit const, and display_sRGB static and const. http://bugzilla.maptools.org/show_bug.cgi?id=2124 @@ -954,7 +1840,7 @@ 2009-09-03 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_getimage.c: Fixed error recognition handling in RGBA - interface when stoponerror is set. + interface when stoponerror is set. http://bugzilla.maptools.org/show_bug.cgi?id=2071 2009-08-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -1003,7 +1889,7 @@ * libtiff/tif_dirread.c (TIFFReadCustomDirectory): Apply patch from Jay Berkenbilt for "Bug 1895 - logic error in tif_dirread.c: - segfault after setting tdir_tag = IGNORE". + segfault after setting tdir_tag = IGNORE". http://bugzilla.maptools.org/show_bug.cgi?id=1895 2009-08-23 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -1012,7 +1898,7 @@ tiffcrop.sh into a collection of many specific tests. Re-wrote all of the existing tests to be based on some simple shell functions. Make distcheck works again. - + Export certain variables (MAKE, MAKEFLAGS, MEMCHECK) to tests and added 'memcheck' and 'ptrcheck' targets to make it easy to run the tests under valgrind. @@ -1046,7 +1932,7 @@ 1 on success instead of zero. http://bugzilla.maptools.org/show_bug.cgi?id=2069 - * libtiff/tif_lzw.c: back out patch from #2065 and apply patch from + * libtiff/tif_lzw.c: back out patch from #2065 and apply patch from #1085 for a better underflow fix that errors properly. http://bugzilla.maptools.org/show_bug.cgi?id=2065 http://bugzilla.maptools.org/show_bug.cgi?id=1985 @@ -1058,13 +1944,13 @@ 2009-06-22 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_lzw.c: Fix buffer underflow bug. + * libtiff/tif_lzw.c: Fix buffer underflow bug. http://bugzilla.maptools.org/show_bug.cgi?id=2065 2009-06-21 Frank Warmerdam <warmerdam@pobox.com> * configure.ac, libtiff/tif_jpeg.c, libtiff/tif_jpeg_12.c: add support - for dual mode 8/12 bit jpeg support. + for dual mode 8/12 bit jpeg support. 2009-06-03 Frank Warmerdam <warmerdam@pobox.com> @@ -1081,7 +1967,7 @@ * libtiff/{tif_jpeg.c,tif_ojpeg.c,tif_getimage.c}: Fixed various error reports to use "%s" as format string. http://trac.osgeo.org/gdal/ticket/2976 - + 2009-03-12 Frank Warmerdam <warmerdam@pobox.com> * libtiff/{tif_fax3.c,tif_jpeg.c,tif_ojpeg.c}: Fix printdir chaining @@ -1089,7 +1975,7 @@ 2009-02-12 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_luv.c: Fix handling of tiled logluv images. + * libtiff/tif_luv.c: Fix handling of tiled logluv images. http://bugzilla.maptools.org/show_bug.cgi?id=2005 2009-02-09 Frank Warmerdam <warmerdam@pobox.com> @@ -1105,17 +1991,17 @@ 2009-02-05 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_dirread.c: Re-incorporated a sanity check on tag size, - but at the 2GB boundary to avoid overflow on 32bit systems. + but at the 2GB boundary to avoid overflow on 32bit systems. http://bugzilla.maptools.org/show_bug.cgi?id=1993 * libtiff/tif_dirread.c: Remove some assertions that blow due to - corrupt files rather than in response to library internal - inconsistencies. + corrupt files rather than in response to library internal + inconsistencies. http://bugzilla.maptools.org/show_bug.cgi?id=1995 http://bugzilla.maptools.org/show_bug.cgi?id=1991 * libtiff/tif_dirread.c: Fixed testing for failed result from - TIFFReadDirectoryFindFieldInfo(). + TIFFReadDirectoryFindFieldInfo(). http://bugzilla.maptools.org/show_bug.cgi?id=1992 2009-01-23 Frank Warmerdam <warmerdam@pobox.com> @@ -1124,17 +2010,17 @@ http://bugzilla.maptools.org/show_bug.cgi?id=1911 * libtiff/tif_dirwrite.c: Fix byte swapping of next directory offset. - + http://bugzilla.maptools.org/show_bug.cgi?id=1924 - * tools/tiffcrop.c: initialize xres/yres values. + * tools/tiffcrop.c: initialize xres/yres values. * test/*.sh - default ${srcdir} to local directory. - * test/common.sh - start verbose mode after common settings. + * test/common.sh - start verbose mode after common settings. - * libtiff/tif_dirinfo.c: Replace lfind() with local equivelent to - avoid type mismatches on different platforms. + * libtiff/tif_dirinfo.c: Replace lfind() with local equivelent to + avoid type mismatches on different platforms. http://bugzilla.maptools.org/show_bug.cgi?id=1889 2009-01-22 Frank Warmerdam <warmerdam@pobox.com> @@ -1143,7 +2029,7 @@ tiffsplit.c}: avoid warnings, mostly 32bit/64bit casting issues. * port,tools: Introduce libport.h, and include in tools if NEED_LIBPORT - defined, primarily to reduce prototype warnings on windows. + defined, primarily to reduce prototype warnings on windows. * libtiff/tif_dirinfo.c,tif_dirread.c: Avoid warnings about unused parameters, and uninitialized variables. @@ -1191,7 +2077,7 @@ for TIFFError(), TIFFErrorExt(), TIFFWarning(), and TIFFWarningExt() in order to reveal bugs. - * Many fixes throughout to work better as a 64-bit build. + * Many fixes throughout to work better as a 64-bit build. 2008-12-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -1242,7 +2128,7 @@ 2008-10-09 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_jpeg.c: Add #ifdefs for changes needed if using - IPP enabled version of libjpeg from Intel. + IPP enabled version of libjpeg from Intel. http://bugzilla.maptools.org/show_bug.cgi?id=1951 2008-09-05 Andrey Kiselev <dron@ak4719.spb.edu> @@ -1285,7 +2171,7 @@ 2008-07-29 Frank Warmerdam <warmerdam@pobox.com> - * tif_strip.c: Replace assertions related to samplesperpixel != 3 or + * tif_strip.c: Replace assertions related to samplesperpixel != 3 or the subsampling values not being 1, 2 or 4 (for jpeg compressed images) with control logic to return runtime errors (c/o Even Rouault) (#1927). @@ -1325,13 +2211,13 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2008-05-24 Frank Warmerdam <warmerdam@pobox.com> - * tif_codec.c: Avoid NULL pointer dereferencing for exotic + * tif_codec.c: Avoid NULL pointer dereferencing for exotic compression codec codes. * tif_dirwrite.c: fix potential memory leak. * tif_dirread.c: Fix unchecked malloc result. - + 2008-05-24 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> * test {tiff2pdf.sh tiff2ps-EPS1.sh tiff2ps-PS1.sh tiff2ps-PS2.sh @@ -1365,7 +2251,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirinfo.c: Use TIFF_SETGET_ASCII for PIXAR_TEXTUREFORMAT and PIXAR_WRAPMODES instead of TIFF_SETGET_UNDEFINED. Not exactly clear - why this is needed. + why this is needed. 2008-05-09 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -1406,25 +2292,25 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2008-03-14 Frank Warmerdam <warmerdam@pobox.com> * tif_dirread.c: Removed sanity checks on tags larger than 4MB in - TIFFReadDirEntryArray() since they are interfering with seemingly + TIFFReadDirEntryArray() since they are interfering with seemingly legitimate files. http://trac.osgeo.org/gdal/ticket/2005 2008-02-09 Joris Van Damme <joris.at.lebbeke@skynet.be> - * tif_dirread.c: Added handling for the case of number of values for - PageNumber tag different from 2 (previously resulted in an assert + * tif_dirread.c: Added handling for the case of number of values for + PageNumber tag different from 2 (previously resulted in an assert indicating lack of handling and was forgotten about) 2008-02-01 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: Do not try to fixup subsampling tags based on + * libtiff/tif_jpeg.c: Do not try to fixup subsampling tags based on the actual jpeg data stream if the first strip/tile has zero size. This is the case when GDAL creates a new file with zero sizes, closes and reopens it. 2008-01-07 Frank Warmerdam <warmerdam@pobox.com> - * tools/tiff2ps.c: fix up 64bit issues (from Edward Lam). + * tools/tiff2ps.c: fix up 64bit issues (from Edward Lam). 2008-01-01 Frank Warmerdam <warmerdam@pobox.com> @@ -1434,14 +2320,14 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic targets. * tools/tiffinfo.c, tools/tiffcmp.c, tools/gif2tiff.c, tools/bmp2tiff.c - tools/tiff2pdf.c: Fix 64-bit warnings when compiling under MSVC 2005 - (x64). + tools/tiff2pdf.c: Fix 64-bit warnings when compiling under MSVC 2005 + (x64). - * tools/tiffset.c: Changes to reflect the fact that TIFFFieldWithTag() + * tools/tiffset.c: Changes to reflect the fact that TIFFFieldWithTag() and TIFFFieldWithName() now return TIFFField pointers instead of TIFFFieldInfo pointers. - * tools/tiffdump.c: Added ssize_t typedef on Windows since it doesn't + * tools/tiffdump.c: Added ssize_t typedef on Windows since it doesn't exist. This makes it compile again on Windows * tif_aux.c, tif_getimage.c, tif_next.c, tif_predict.c, tif_win32.c, @@ -1452,19 +2338,19 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-12-31 Frank Warmerdam <warmerdam@pobox.com> * tif_dirwrite.c: Added TIFFRewriteField(). This new function - rewrites one field "on disk" updating an existing directory + rewrites one field "on disk" updating an existing directory entry. Lots of limitations still... - * tiffiop.h, tif_write.c, tif_dirread.c, tif_flush.c: Keep track of - TIFF_DIRTYSTRIP separately from TIFF_DIRTYDIRECT to indicate that - the strip offset/size values are dirty but nothing else about the + * tiffiop.h, tif_write.c, tif_dirread.c, tif_flush.c: Keep track of + TIFF_DIRTYSTRIP separately from TIFF_DIRTYDIRECT to indicate that + the strip offset/size values are dirty but nothing else about the directory is dirty. In flush handle "just stripmaps dirty" as a - special case that just rewrites these values without otherwise - modifying the directory on disk using TIFFRewriteField(). + special case that just rewrites these values without otherwise + modifying the directory on disk using TIFFRewriteField(). We also modify logic so that in update mode the directory is not marked dirty on read, but only when something is changed. This - means we need to keep track of updates to the stripmap stuff in + means we need to keep track of updates to the stripmap stuff in TIFFAppendToStrip(). 2007-12-10 Frank Warmerdam <warmerdam@pobox.com> @@ -1475,7 +2361,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-11-23 Frank Warmerdam <warmerdam@pobox.com> * tif_dir.c, tif_dirread.c, tif_dirwrite.c, tif_read.c, tif_write.c, - tiffiop.h: Added TIFF_BUF4WRITE flag to indicate if contents of the + tiffiop.h: Added TIFF_BUF4WRITE flag to indicate if contents of the rawcp/rawcc buffer are for writing and thus may require flushing. Necessary to distinguish whether they need to be written to disk when in mixed read/write mode and doing a mixture of writing followed by @@ -1488,12 +2374,12 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-11-02 Frank Warmerdam <warmerdam@pobox.com> - * tif_write.c: Rip out the fancy logic in TIFFAppendToStrip() for - establishing if an existing tile can be rewritten to the same location - by comparing the current size to all the other blocks in the same - directory. This is dangerous in many situations and can easily + * tif_write.c: Rip out the fancy logic in TIFFAppendToStrip() for + establishing if an existing tile can be rewritten to the same location + by comparing the current size to all the other blocks in the same + directory. This is dangerous in many situations and can easily corrupt a file. (observed in esoteric GDAL situation that's hard to - document). This change involves leaving the stripbytecount[] values + document). This change involves leaving the stripbytecount[] values unaltered till TIFFAppendToStrip(). Now we only write a block back to the same location it used to be at if the new data is the same size or smaller - otherwise we move it to the end of file. @@ -1501,30 +2387,30 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tif_dirwrite.c: Try to avoid writing out a full readbuffer of tile data when writing the directory just because we have BEENWRITING at some point in the past. This was causing odd junk to be written out - in a tile of data when a single tile had an interleaving of reading - and writing with reading last. (highlighted by gdal - autotest/gcore/tif_write.py test 7. + in a tile of data when a single tile had an interleaving of reading + and writing with reading last. (highlighted by gdal + autotest/gcore/tif_write.py test 7. * tif_predict.c: use working buffer in PredictorEncodeTile to avoid - modifying callers buffer. + modifying callers buffer. http://trac.osgeo.org/gdal/ticket/1965 - * tif_predict.c/h: more fixes related to last item, keeping a + * tif_predict.c/h: more fixes related to last item, keeping a distinct pfunc for encode and decode cases as these were getting mixed up sometimes. http://trac.osgeo.org/gdal/ticket/1948 2007-11-01 Frank Warmerdam <warmerdam@pobox.com> - * tif_predict.c/h, tif_lzw.c, tif_zip.c: Improvements so that + * tif_predict.c/h, tif_lzw.c, tif_zip.c: Improvements so that predictor based encoding and decoding works in read-write update - mode properly. + mode properly. http://trac.osgeo.org/gdal/ticket/1948 2007-10-24 Joris Van Damme <joris.at.lebbeke@skynet.be> - * tif_dirread.c: Fixed problem with bogus file triggering - assert(td->td_planarconfig == PLANARCONFIG_CONTIG) in + * tif_dirread.c: Fixed problem with bogus file triggering + assert(td->td_planarconfig == PLANARCONFIG_CONTIG) in ChopUpSingleUncompressedStrip 2007-10-22 Joris Van Damme <joris.at.lebbeke@skynet.be> @@ -1548,10 +2434,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-09-29 Joris Van Damme <joris.at.lebbeke@skynet.be> - * tif_dirread.c: Strip chopping interfered badly with uncompressed - subsampled images because it tried to divide subsampled rowblocks, - leading to all sorts of errors throughout the library for these - images. Fixed by making strip chopping divide in row counts that + * tif_dirread.c: Strip chopping interfered badly with uncompressed + subsampled images because it tried to divide subsampled rowblocks, + leading to all sorts of errors throughout the library for these + images. Fixed by making strip chopping divide in row counts that are a multiple of vertical subsampling value. 2007-09-28 Joris Van Damme <joris.at.lebbeke@skynet.be> @@ -1564,18 +2450,18 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tif_dirread.c: Made calculation of td_maxsamplevalue more robust when dealing with large bitspersample values, shutting up purification - tools that warn about truncation, though it remains incorrect and + tools that warn about truncation, though it remains incorrect and indicates a conceptual problem there. - * tif_open.c: Moved early exit in case of 'h' flag (to disable reading - of first IFD) to proper place because it badly interfered with memory - mapping, resulting in mapping flag even with dummy mapping functions - that returned 0 whilst at the same time the mapping tif_size wasn't + * tif_open.c: Moved early exit in case of 'h' flag (to disable reading + of first IFD) to proper place because it badly interfered with memory + mapping, resulting in mapping flag even with dummy mapping functions + that returned 0 whilst at the same time the mapping tif_size wasn't set, thus resulting in continuous incorrect beyond-eof errors. 2007-09-24 Joris Van Damme <joris.at.lebbeke@skynet.be> - * tif_dirinfo.c: Fixed (MSVC) compiler reports about + * tif_dirinfo.c: Fixed (MSVC) compiler reports about inconsistent use of const in tiffFields and exifFields definition 2007-09-20 Frank Warmerdam <warmerdam@pobox.com> @@ -1585,7 +2471,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic TIFFWriteDirectoryTagLongLong8Array() function was restructured accordingly. - * tif_dirread.c: Improvements to error reporting text in + * tif_dirread.c: Improvements to error reporting text in TIFFFetchDirectory(). 2007-09-19 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -1599,27 +2485,27 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-08-24 Frank Warmerdam <warmerdam@pobox.com> * tif_dirwrite.c: Write the tif_nextdiroff value instead of a fixed - zero when writing directory contents to preserve the ability to + zero when writing directory contents to preserve the ability to rewrite directories in place, even in the middle of a directory chain. * tif_dirinfo.c: _TIFFMergeFields() now only merges in field definitions that are missing. Existing definitions are silently - ignored. + ignored. * tif_dirread.c: Add runtime error for fields for which no definition - is found (in addition to an assert for developers) in - TIFFFetchNormalTag(). Not sure if this is needed, but it seems + is found (in addition to an assert for developers) in + TIFFFetchNormalTag(). Not sure if this is needed, but it seems prudent. 2007-08-10 Joris Van Damme <joris.at.lebbeke@skynet.be> - * libtiff/tif_getimage.c: removed SubsamplingHor and SubsamplingVer + * libtiff/tif_getimage.c: removed SubsamplingHor and SubsamplingVer from _TIFFRGBAImage structure to revert unwanted ABI change. 2007-08-10 Joris Van Damme <joris.at.lebbeke@skynet.be> - * libtiff/tif_win32.c: use SetFilePointer instead of + * libtiff/tif_win32.c: use SetFilePointer instead of SetFilePointerEx, as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1580 @@ -1641,7 +2527,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirread.c: Handle the case of MSVC 6 when using 64-bit integer constants. - * libtiff/{Makefile.am, Makefile.v}: Do not distribute tiffconf.h, + * libtiff/{Makefile.am, Makefile.v}: Do not distribute tiffconf.h, remove tif_config.h/tiffconf.h during cleaning. As per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1573 @@ -1711,14 +2597,14 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic tif_win3.c}: Obsoleted portability stuff removed. * tools/tiff2ps.c: Added support 16-bit images as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1566 Patch from William Bader. * tools/tiff2pdf.c: Fix for TIFFTAG_JPEGTABLES tag fetching and significant upgrade of the whole utility as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1560 Now we don't need tiffiop.h in tiff2pdf anymore and will open output @@ -1736,7 +2622,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-06-25 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> * port/strtoull.c: New porting function in case strtoull() is not - available on the target system. + available on the target system. * configure.ac: Add configure support for determining sized types in a portable way and performing necessary substitutions in tif_config.h and tiffconf.h. Updated tiff.h to use the new @@ -1753,7 +2639,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/{tif_dir.h, tif_dirread.c, tif_dirinfo.c, tif_jpeg.c, tif_fax3.c, tif_jbig.c, tif_luv.c, tif_ojpeg.c, tif_pixarlog.c, tif_predict.c, tif_zip.c}: Finally fix bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1274 by introducing _TIFFMergeFieldInfo() returning integer error status @@ -1764,7 +2650,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2007-04-07 Frank Warmerdam <warmerdam@pobox.com> - * contrib/addtiffo/tif_overview.c: Fix problems with odd sized output + * contrib/addtiffo/tif_overview.c: Fix problems with odd sized output blocks in TIFF_DownSample_Subsampled() (bug 1542). 2007-04-06 Frank Warmerdam <warmerdam@pobox.com> @@ -1772,15 +2658,15 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_jpeg.c: Changed JPEGInitializeLibJPEG() so that it will convert from decompressor to compressor or compress to decompress if required by the force arguments. This works around a problem in - where the JPEGFixupTestSubsampling() may cause a decompressor to + where the JPEGFixupTestSubsampling() may cause a decompressor to be setup on a directory when later a compressor is required with the - force flag set. Occurs with the addtiffo program for instance. + force flag set. Occurs with the addtiffo program for instance. 2007-04-06 Andrey Kiselev <dron@ak4719.spb.edu> * tools/tiffcrop.c, man/tiffcrop.1: Significant update in functionality from Richard Nolde. As per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1525 2007-03-28 Frank Warmerdam <warmerdam@pobox.com> @@ -1792,15 +2678,15 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * start of BigTIFF upgrade - CVS HEAD unstable until further notice 2007-03-07 Joris Van Damme <joris.at.lebbeke@skynet.be> - + * libtiff/tif_getimage.c: workaround for 'Fractional scanline' error reading OJPEG images with rowsperstrip that is not a multiple of vertical subsampling factor. This bug is mentioned in: http://bugzilla.remotesensing.org/show_bug.cgi?id=1390 - http://www.asmail.be/msg0054766825.html + http://www.asmail.be/msg0054766825.html 2007-03-07 Joris Van Damme <joris.at.lebbeke@skynet.be> - + * libtiff/tif_win32.c: made inclusion of windows.h unconditional * libtiff/tif_win32.c: replaced preprocessor indication for consiously @@ -1850,14 +2736,14 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic larger than 2GB. Fixes bug http://bugzilla.remotesensing.org/show_bug.cgi?id=890 - + Idea submitted by Matt Hancher. 2007-01-31 Andrey Kiselev <dron@ak4719.spb.edu> * tools/tif2rgba.c: This utility does not work properly on big-endian architectures. It was fixed including the bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1149 2007-01-15 Mateusz Loskot <mateusz@loskot.net> @@ -1874,15 +2760,15 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2006-11-19 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_write.c: TIFFAppendToStrip() - clear sorted flag if - we move a strip. - http://bugzilla.remotesensing.org/show_bug.cgi?id=1359 + * libtiff/tif_write.c: TIFFAppendToStrip() - clear sorted flag if + we move a strip. + http://bugzilla.remotesensing.org/show_bug.cgi?id=1359 2006-10-13 Andrey Kiselev <dron@ak4719.spb.edu> * libtiff/tif_dir.c: More fixes for vulnerabilities, reported in Gentoo bug (): - + http://bugs.gentoo.org/show_bug.cgi?id=142383 * libtiff/contrib/dbs/xtiff/xtiff.c: Make xtiff utility compilable. @@ -1916,12 +2802,12 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_lzw.c, libtiff/tif_zip.c: Fixed problems with mixing encoding and decoding on the same read-write TIFF handle. The LZW code can now maintain encode and decode state at the same time. The - ZIP code will switch back and forth as needed. + ZIP code will switch back and forth as needed. http://bugzilla.remotesensing.org/show_bug.cgi?id=757 2006-09-20 Frank Warmerdam <warmerdam@pobox.com> - * libtiff: Rename config.h.vc and tif_config.h.vc to config.vc.h and + * libtiff: Rename config.h.vc and tif_config.h.vc to config.vc.h and tif_config.vc.h for easier identification by folks using an IDE. 2006-07-25 Frank Warmerdam <warmerdam@pobox.com> @@ -1936,7 +2822,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2006-07-12 Frank Warmerdam <warmerdam@pobox.com> - * tif_dirwrite.c: make sure to use uint32 for wordcount in + * tif_dirwrite.c: make sure to use uint32 for wordcount in TIFFWriteNormanTag if writecount is VARIABLE2 for ASCII fields. It already seems to have been done for other field types. Needed for "tiffset" on files with geotiff ascii text. @@ -1964,9 +2850,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2006-06-17 Frank Warmerdam <warmerdam@pobox.com> * tif_readdir.c: Added case in EstimateStripByteCounts() for tiled - files. Modified TIFFReadDirectory() to not invoke + files. Modified TIFFReadDirectory() to not invoke EstimateStripByteCounts() for case where entry 0 and 1 are unequal - but one of them is zero. + but one of them is zero. http://bugzilla.remotesensing.org/show_bug.cgi?id=1204 2006-06-08 Andrey Kiselev <dron@ak4719.spb.edu> @@ -1994,7 +2880,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * {configure, configure.ac, libtiff/tif_jbig.c, tools/tiffcp.c}: Added support for JBIG compression scheme (34661 code) contributed by Lee Howard. As per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=896 * configure, configure.ac: OJPEG support enabled by default. @@ -2033,7 +2919,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2006-04-18 Frank Warmerdam <warmerdam@pobox.com> * nmake.opt: use /EHsc for VS2005 compatibility. Also define - _CRT_SECURE_NO_DEPRECATE to avoid noise on VS2005. + _CRT_SECURE_NO_DEPRECATE to avoid noise on VS2005. 2006-04-12 Joris Van Damme <joris.at.lebbeke@skynet.be> @@ -2041,7 +2927,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic non-subsampled YCbCr (i.e. separate YCbCr with subsampling [1,1]) 2006-04-11 Joris Van Damme <joris.at.lebbeke@skynet.be> - + * libtiff/tif_getimage.c: Revision of all RGB(A) put routines - Conversion of unassociated alpha to associated alpha now done with more performant LUT, and calculation more correct @@ -2050,21 +2936,21 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic - Bugfix of handling of 16bit RGB with unassociated alpha 2006-04-11 Joris Van Damme <joris.at.lebbeke@skynet.be> - - * libtiff/tif_getimage.c: - - When there is no alpha, gtTileSeparate and gtStripSeparate allocated - buffer for alpha strile and filled it, only to never read it back. + + * libtiff/tif_getimage.c: + - When there is no alpha, gtTileSeparate and gtStripSeparate allocated + buffer for alpha strile and filled it, only to never read it back. Removed allocation and fill. - - Minor rename of vars in gtTileSeparate and gtStripSeparate + - Minor rename of vars in gtTileSeparate and gtStripSeparate anticipating planned functionality extension 2006-04-08 Joris Van Damme <joris.at.lebbeke@skynet.be> - * libtiff/tif_getimage.c: renamed pickTileContigCase to PickContigCase - and pickTileSeparateCase to PickSeparateCase as both work on strips as + * libtiff/tif_getimage.c: renamed pickTileContigCase to PickContigCase + and pickTileSeparateCase to PickSeparateCase as both work on strips as well - * libtiff/tif_getimage.c: moved img->get selection from + * libtiff/tif_getimage.c: moved img->get selection from TIFFRGBAImageBegin into PickContigCase and PickSeparateCase to create logical hook for planned functionality extension @@ -2075,9 +2961,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2006-04-07 Joris Van Damme <joris.at.lebbeke@skynet.be> - * libtiff/tif_getimage.c: replaced usage of TIFFScanlineSize in + * libtiff/tif_getimage.c: replaced usage of TIFFScanlineSize in gtStripContig with TIFFNewScanlineSize so as to fix buggy behaviour - on subsampled images - this ought to get sorted when we feel brave + on subsampled images - this ought to get sorted when we feel brave enough to replace TIFFScanlineSize alltogether * libtiff/tif_ojpeg.c: fixed bug in OJPEGReadSkip @@ -2086,13 +2972,13 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tiffio.h: added new type tstrile_t - * libtiff/tif_dir.h: changed types of td_stripsperimage and td_nstrips - to new tstrile_t, types of td_stripoffset and td_stripbytecount to + * libtiff/tif_dir.h: changed types of td_stripsperimage and td_nstrips + to new tstrile_t, types of td_stripoffset and td_stripbytecount to toff_t* * libtiff/tif_ojpeg.c: totally new implementation - * libtiff/tif_dirread.c: added several hacks to suit new support of + * libtiff/tif_dirread.c: added several hacks to suit new support of OJPEG * libtiff/tif_getimage.c: removed TIFFTAG_JPEGCOLORMODE handling @@ -2132,7 +3018,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_getimage.c: added putcontig8bitYCbCr12tile - * libtiff/tif_read.c: added support for new TIFF_NOREADRAW flag to + * libtiff/tif_read.c: added support for new TIFF_NOREADRAW flag to prepare the path for new tif_ojpeg.c 2006-03-23 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2248,7 +3134,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_write.c: Small code rearrangement in TIFFWriteScanline() to avoid crash as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1081. 2006-02-26 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2298,7 +3184,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2006-02-07 Frank Warmerdam <warmerdam@pobox.com> * tools/tiff2pdf.c: Fixed support for non-YCbCr encoded JPEG - compressed TIFF files, per submission from Dan Cobra. + compressed TIFF files, per submission from Dan Cobra. 2006-02-07 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2330,7 +3216,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirread.c: Use _TIFFGetExifFieldInfo() instead of _TIFFGetFieldInfo() in TIFFReadEXIFDirectory() call as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=1026. 2006-01-23 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2396,7 +3282,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2005-12-26 Andrey Kiselev <dron@ak4719.spb.edu> - * libtiff/{tif_dir.c, tif_dir.h, tif_dirread.c, tif_dirinfo.c}: + * libtiff/{tif_dir.c, tif_dir.h, tif_dirread.c, tif_dirinfo.c}: tiffFieldInfo and exifFieldInfo arrays definitions moved back to tif_dirinfo.c; added _TIFFGetFieldInfo() and _TIFFGetExifFieldInfo() private functions to retrieve FieldInfo arrays. @@ -2423,10 +3309,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2005-12-23 Joris Van Damme <joris.at.lebbeke@skynet.be> - * libtiff/tiffio.h: fixed typo that potentially resulted in + * libtiff/tiffio.h: fixed typo that potentially resulted in redefininition of USE_WIN32_FILEIO - * libtiff/*: Added more 'dual-mode' error handling: Done TIFFWarning + * libtiff/*: Added more 'dual-mode' error handling: Done TIFFWarning calls in core LibTiff. 2005-12-21 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2436,10 +3322,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2005-12-21 Joris Van Damme <joris.at.lebbeke@skynet.be> - * libtiff/*, contrib/*: Added 'dual-mode' error handling, enabling + * libtiff/*, contrib/*: Added 'dual-mode' error handling, enabling newer code to get context indicator in error handler and still - remain compatible with older code: Done TIFFError calls everywhere - except in tools + remain compatible with older code: Done TIFFError calls everywhere + except in tools 2005-12-20 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2512,7 +3398,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=1002 * .cvsignore: many files added, and a few update according - to suggestion of Brad HArds on tiff mailing list. + to suggestion of Brad HArds on tiff mailing list. 2005-11-03 Frank Warmerdam <warmerdam@pobox.com> @@ -2537,7 +3423,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=946 * tools/bmp2tiff.c: Fixed possible integer overflow error as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=965 * libtiff/tif_dirinfo.c: Make XResolution, YResolution and @@ -2547,7 +3433,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tools/tiffsplit.c: Copy fax related fields over splitted parts as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=983 2005-10-21 Frank Warmerdam <warmerdam@pobox.com> @@ -2603,7 +3489,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dir.c: When prefreeing tv->value in TIFFSetFieldV also set it to NULL to avoid double free when re-setting custom - string fields as per: + string fields as per: http://bugzilla.remotesensing.org/show_bug.cgi?id=922 @@ -2639,7 +3525,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=831 Remove TIFFFetchExtraSamples() function, use TIFFFetchNormalTag() - instead. + instead. * libtiff/tiffconf.h.in: One more attempt to fix the AIX bug @@ -2810,7 +3696,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2005-05-22 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_dirread.c: Changed the code that computes + * libtiff/tif_dirread.c: Changed the code that computes stripbytecount[0] if it appears bogus to ignore if stripoffset[0] is zero. This is a common case with GDAL indicating a "null" tile/strip. @@ -2820,8 +3706,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2005-05-06 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_dirread.c: Applied similar change to - TIFFFetchPerSampleLongs and TIFFFetchPerSampleAnys. + * libtiff/tif_dirread.c: Applied similar change to + TIFFFetchPerSampleLongs and TIFFFetchPerSampleAnys. http://bugzilla.remotesensing.org/show_bug.cgi?id=843 @@ -2871,7 +3757,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * man/TIFFSetField.3tiff: Fixed definition of the TIFFTAG_INKNAMES tag as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=816 2005-03-30 Andrey Kiselev <dron@ak4719.spb.edu> @@ -2981,7 +3867,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tiffio.h: Move TIFFOpenW() function into the extern "C"{} block as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=763 2005-02-03 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -3002,7 +3888,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=320 * tools/tiff2ps.c: Fixed problem with page sizes as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=742 2005-01-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -3043,7 +3929,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic TIFFRGBAImageBegin() as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=739 - + 2005-01-12 Andrey Kiselev <dron@ak4719.spb.edu> * libtiff/tif_jpeg.c: Added ability to read/write the fax specific @@ -3072,7 +3958,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tiff.h: Restore back the workaround for AIX Visual Age C compiler to avoid double definition of BSD types as per bug - http://bugzilla.remotesensing.org/show_bug.cgi?id=39 + http://bugzilla.remotesensing.org/show_bug.cgi?id=39 * libtiff/Makefile.am: Place the C++ stream API in the separate library called libtiffxx to avoid unneeded dependencies. Probably @@ -3096,7 +3982,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_getimage.c: More fixes for multiple-alpha-channelled RGB-images as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=713 @@ -3132,7 +4018,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-12-15 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_getimage.c: #define A1 bracketing for clean build on - SunPro compiler. + SunPro compiler. 2004-12-11 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> @@ -3144,7 +4030,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirwrite.c: Always write TIFFTAG_SUBIFD using LONG type as per bugs - + http://bugzilla.remotesensing.org/show_bug.cgi?id=703 and @@ -3164,9 +4050,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_config.in.vc: Removed unneded definitions for read/open/close/lseek functions to fix the - + http://bugzilla.remotesensing.org/show_bug.cgi?id=680 - + 2004-12-03 Andrey Kiselev <dron@ak4719.spb.edu> * libtiff/{tif_dir.c, tif_dirread.c}: Remove TIFFReassignTagToIgnore() @@ -3202,7 +4088,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-11-26 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/makefile.vc: make it easier to rename the libtiff DLL. + * libtiff/makefile.vc: make it easier to rename the libtiff DLL. 2004-11-24 Andrey Kiselev <dron@ak4719.spb.edu> @@ -3299,7 +4185,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=648 - + * libtiff/{tif_jpeg.c, tif_ojpeg.c}: TIFFTAG_JPEGTABLES should have uint32 count. Use this type everywhere. @@ -3312,7 +4198,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tools/tiff2rgba.c: removed extra newlines in usage message. 2004-10-30 Andrey Kiselev <dron@ak4719.spb.edu> - + * libtiff/tif_dirwrite.c: Improvements in tag writing code. * tools/tiff2ps.c: Fixed wrong variable data type when read Position @@ -3327,7 +4213,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_fax3.c: Fixed case with the wrong decode routines choosing when the incorrect Group4Options tag set. As per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=323 * libtiff/tif_dirwrite.c: Fixed problem with passing count variable of @@ -3346,7 +4232,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tools/tiff2pdf.c: added casts to avoid warnings. * libtiff/libtiff.def: Added several more entry points required - to link fax2tiff.c against the DLL on windows. + to link fax2tiff.c against the DLL on windows. 2004-10-27 Andrey Kiselev <dron@ak4719.spb.edu> @@ -3417,7 +4303,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-10-08 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_dirinfo.c: Fix bug with tif_foundfield and reallocation - of tif_fieldinfo. + of tif_fieldinfo. http://bugzilla.remotesensing.org/show_bug.cgi?id=630 @@ -3449,7 +4335,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-09-30 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_dirinfo.c: changed type of XMLPacket (tag 700) to + * libtiff/tif_dirinfo.c: changed type of XMLPacket (tag 700) to TIFFTAG_BYTE instead of TIFFTAG_UNDEFINED to comply with the info in the Adobe XMP Specification. @@ -3469,7 +4355,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-09-26 Andrey Kiselev <dron@ak4719.spb.edu> * libtiff/{tif_dir.h, tif_dir.c, tif_dirread.c, tif_write.c}: - Optimize checking for the strip bounds. + Optimize checking for the strip bounds. * libtiff/{tif_dirread.c, tif_strip.c}: TIFFScanlineSize() and TIFFRasterScanlineSize() functions report zero in the case of integer @@ -3620,7 +4506,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic here http://www.asmail.be/msg0054799560.html - + for details. * tools/fax2tiff.c: Use the new functions in the code. @@ -3748,11 +4634,11 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tools/tiffsplit.c: Fixed problem with unproperly written multibyte files. Now output files will be written using the same byte order flag as in the input image. See - + http://bugzilla.remotesensing.org/show_bug.cgi?id=574 - + for details. - + 2004-05-19 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_print.c: added (untested) support for printing @@ -3764,7 +4650,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_fax3.c: Avoid reading CCITT compression options if compression type mismatches. See - + http://bugzilla.remotesensing.org/show_bug.cgi?id=565 2004-04-30 Andrey Kiselev <dron@ak4719.spb.edu> @@ -3809,7 +4695,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-04-04 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_open.c: close clientdata if TIFFClientOpen() fails - via bad2. + via bad2. 2004-03-26 Andrey Kiselev <dron@ak4719.spb.edu> @@ -3836,10 +4722,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-02-26 Andrey Kiselev <dron@ak4719.spb.edu> - * tools/tiffsplit.c: Copy JPEGTables tag contents for JPEG compressed + * tools/tiffsplit.c: Copy JPEGTables tag contents for JPEG compressed images. Reported by Artem Mirolubov. - * libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED + * libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED tag type in TIFFFetchNormalTag() as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=508 @@ -3861,8 +4747,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2004-01-30 Frank Warmerdam <warmerdam@pobox.com> * libtiff/libtiff.def: Added TIFFCurrentDirOffset, TIFFWriteCheck, - TIFFRGBAImageOK, and TIFFNumberOfDirectories as suggested by - Scott Reynolds. + TIFFRGBAImageOK, and TIFFNumberOfDirectories as suggested by + Scott Reynolds. 2004-01-29 Andrey Kiselev <dron@ak4719.spb.edu> @@ -3880,7 +4766,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic file if TIFFFdOpen() failed as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=468 - + * libtiff/tif_open.c: More fixes for http://bugzilla.remotesensing.org/show_bug.cgi?id=468 @@ -3904,7 +4790,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirwrite.c: Fixed handling of writable ASCII tags that are field_passcount=TRUE properly. Arguably anonymous custom tags should be declared as passcount=FALSE, but I don't want to change - that without a careful review. + that without a careful review. 2004-01-20 Andrey Kiselev <dron@ak4719.spb.edu> @@ -4067,8 +4953,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2003-11-17 Frank Warmerdam <warmerdam@pobox.com> - * tif_dirread.c: do not mark all anonymously defined tags to be - IGNOREd. + * tif_dirread.c: do not mark all anonymously defined tags to be + IGNOREd. 2003-11-17 Andrey Kiselev <dron@ak4719.spb.edu> @@ -4108,15 +4994,15 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2003-11-09 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_tile.c: remove spurious use of "s" (sample) in the + * libtiff/tif_tile.c: remove spurious use of "s" (sample) in the planarconfig_contig case in TIFFComputeTile(). http://bugzilla.remotesensing.org/show_bug.cgi?id=387 2003-11-09 Andrey Kiselev <dron@ak4719.spb.edu> - + * libtiff/tiffiop.h: New macros: TIFFmax, TIFFmin and TIFFrint. - + 2003-11-07 Andrey Kiselev <dron@ak4719.spb.edu> * libtiff/{tiffio.h, tif_strip.c}, man/{TIFFstrip.3t, libtiff.3t}: @@ -4183,11 +5069,11 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic function TIFFReadRGBAImageOriented() implemented to retrieve raster array with user-specified origin position as suggested by Jason Frank. See - + http://bugzilla.remotesensing.org/show_bug.cgi?id=322 for details. - + * tools/tiff2rgba.c: Switched to use TIFFReadRGBAImageOriented() instead of TIFFReadRGBAImage(). @@ -4268,9 +5154,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic encoded write functions use tif_postdecode() to apply byte order swapping (swab) to the application passed data buffer if the same would be done when reading. This allows us to write pixel data with - more than 8 bits per sample to existing files of a non-native byte + more than 8 bits per sample to existing files of a non-native byte order. One side effect of this change is the applications buffer - itself is altered in this case by the act of writing. + itself is altered in this case by the act of writing. http://bugzilla.remotesensing.org/show_bug.cgi?id=171 @@ -4296,9 +5182,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2003-07-08 Frank Warmerdam <warmerdam@pobox.com> * tif_aux.c, tif_codec.c, tif_dir.c, tif_dirread.c, tif_extension.c, - tif_fax3.c, tif_getimage.c, tif_luv.c, tif_lzw.c, tif_next.c, + tif_fax3.c, tif_getimage.c, tif_luv.c, tif_lzw.c, tif_next.c, tif_packbits.c, tif_predict.c, tif_print.c, tif_swab.c, tif_thunder.c: - avoid casting warning at /W4. + avoid casting warning at /W4. 2003-07-03 Andrey Kiselev <dron@ak4719.spb.edu> @@ -4320,11 +5206,11 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirinfo.c: TIFFDataWidth() returns 0 in case of unknown data type. - + 2003-06-19 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_print.c: fixed some serious bugs when printing - custom tags ... almost certain to crash. + custom tags ... almost certain to crash. * libtiff/tif_dirread.c: Don't ignore custom fields that are autodefined. Not sure how this got to be like this. @@ -4335,12 +5221,12 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tools/tiffcmp.c, man/tiffcmp.1: Fixed problem with unused data comparing as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=349 `-z' option now can be used to set the number of reported different bytes. - + 2003-06-09 Andrey Kiselev <dron@ak4719.spb.edu> * tools/tiffcp.c, man/tiffcp.1: Added possibility to specify value -1 @@ -4366,7 +5252,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2003-05-25 Andrey Kiselev <dron@ak4719.spb.edu> * tools/fax2tiff.c: Page numbering fixed, as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=341 2003-05-20 Andrey Kiselev <dron@ak4719.spb.edu> @@ -4432,7 +5318,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * tools/tiffcp.c: Fixed problem with colorspace conversion for JPEG encoded images. See bug entries - + http://bugzilla.remotesensing.org/show_bug.cgi?id=275 and @@ -4493,16 +5379,16 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_jpeg.c: Modified to defer initialization of jpeg library so that we can check if there is already any tile/strip data - before deciding between creating a compressor or a decompressor. + before deciding between creating a compressor or a decompressor. 2003-01-31 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_write.c: TIFFWriteCheck() now fails if the image is - a pre-existing compressed image. That is, image writing to + a pre-existing compressed image. That is, image writing to pre-existing compressed images is not allowed. * libtiff/tif_open.c: Removed error if opening a compressed file - in update mode. + in update mode. http://bugzilla.remotesensing.org/show_bug.cgi?id=198 @@ -4515,16 +5401,16 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * cut 3.6.0 Beta release. 2002-12-20 Andrey Kiselev <dron@ak4719.spb.edu> - + * tools/fax2ps.c, man/fax2ps.1: Page size was determined in wrong way as per bug - + http://bugzilla.remotesensing.org/show_bug.cgi?id=239 2002-12-17 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_dirread.c: Allow wrong sized arrays in - TIFFFetchStripThing(). + * libtiff/tif_dirread.c: Allow wrong sized arrays in + TIFFFetchStripThing(). http://bugzilla.remotesensing.org/show_bug.cgi?id=49 @@ -4538,7 +5424,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dir.c: fixed bug with resetting an existing custom field value. - * libtiff/tif_dir.c: Fixed potential problem with ascii "custom" + * libtiff/tif_dir.c: Fixed potential problem with ascii "custom" tags in TIFFVGetField() ... added missing break. 2002-10-14 Frank Warmerdam <warmerdam@pobox.com> @@ -4550,11 +5436,11 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic the eps by redefining the colorimage operator will get messed up. Patch supplied by William Bader. - * Makefile.in: added tif_extension.c to file list as per + * Makefile.in: added tif_extension.c to file list as per http://bugzilla.remotesensing.org/show_bug.cgi?id=218. 2002-10-11 Andrey Kiselev <dron@ak4719.spb.edu> - + * configure, config.site, libtiff/{tif_unix.c, Makefile.in}: Fix for large files (>2GiB) supporting. New option in the config.site: LARGEFILE="yes". Should be enough for I/O of the large files. @@ -4586,13 +5472,13 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2002-10-06 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_jpeg.c: fixed problem with boolean defined with wrong - size on windows. Use #define boolean hack. + size on windows. Use #define boolean hack. http://bugzilla.remotesensing.org/show_bug.cgi?id=188 * libtiff/tiff.h: Don't do special type handling in tiff.h unless USING_VISUALAGE is defined. - + http://bugzilla.remotesensing.org/show_bug.cgi?id=39 2002-10-03 Frank Warmerdam <warmerdam@pobox.com> @@ -4603,30 +5489,30 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirread.c: Another fix for the fetching SBYTE arrays by the TIFFFetchByteArray() function. Should finally resolve - + http://bugzilla.remotesensing.org/show_bug.cgi?id=52 - + * configure: Set -DPIXARLOG_SUPPORT option along with -DZIP_SUPPORT * html/Makefile.in: New targets added: html and groffhtml for producing HTML representations of the manual pages automatically. html target uses man2html tool, groffhtml uses groff tool. - + 2002-09-29 Frank Warmerdam <warmerdam@pobox.com> * configure, libtiff/Makefile.in: Added SCO OpenServer 5.0.6 support - from John H. DuBois III. + from John H. DuBois III. 2002-09-15 Andrey Kiselev <dron@ak4719.spb.edu> * Makefile.in, /man/{raw2tiff.1, Makefile.in, libtiff.3}: Added manual page for raw2tiff(1) tool. - + 2002-09-12 Andrey Kiselev <dron@ak4719.spb.edu> * /libtiff/{tiffio.h, tif_dir.h}: TIFFDataWidth() declaration moved to the tiffio.h header file. - + * Makefile.in, /man/{TIFFDataWidth.3t, Makefile.in, libtiff.3}: Added manual page for TIFFDataWidth() function @@ -4636,8 +5522,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic as per http://bugzilla.remotesensing.org/show_bug.cgi?id=196. * tools/tiff2ps.c: Don't emit BeginData/EndData DSC comments - since we are unable to properly include the amount to skip. - + since we are unable to properly include the amount to skip. + http://bugzilla.remotesensing.org/show_bug.cgi?id=80 2002-09-02 Andrey Kiselev <dron@ak4719.spb.edu> @@ -4647,7 +5533,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=52 2002-08-22 Andrey Kiselev <dron@ak4719.spb.edu> - + * /libtiff/tif_dirinfo.c: Further additions to free custom fields in _TIFFSetupFieldInfo() function. See http://bugzilla.remotesensing.org/show_bug.cgi?id=169 for details. @@ -4656,14 +5542,14 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic LZWDecode() and LZWDecodeCompat(). Fixes http://bugzilla.remotesensing.org/show_bug.cgi?id=190 and http://bugzilla.remotesensing.org/show_bug.cgi?id=100 - + * /libtiff/tif_lzw.c: Added check for valid code lengths in LZWDecode() and LZWDecodeCompat(). Fixes http://bugzilla.remotesensing.org/show_bug.cgi?id=115 2002-08-16 Andrey Kiselev <dron@ak4719.spb.edu> - + * /libtiff/{Makefile.vc, libtiff.def}: Missed declarations added. @@ -4674,7 +5560,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=177 - * tif_dir.h: changed FIELD_CODEC to 66 from 64 to avoid overlap + * tif_dir.h: changed FIELD_CODEC to 66 from 64 to avoid overlap with FIELD_CUSTOM as mentioned in bug 169. * tif_close.c: added logic to free dynamically created anonymous @@ -4683,31 +5569,31 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=169 2002-08-10 Andrey Kiselev <dron@ak4719.spb.edu> - + * /tools/{raw2tiff.c, Makefile.in, Makefile.lcc, Makefile.vc}: New tool: raw2tiff --- raw images to TIFF converter. No manual page yet. 2002-07-31 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: Fixed problem with setting of nrows in + * libtiff/tif_jpeg.c: Fixed problem with setting of nrows in JPEGDecode() as per bugzilla bug (issue 1): http://bugzilla.remotesensing.org/show_bug.cgi?id=129 * libtiff/{tif_jpeg.c,tif_strip.c,tif_print.c}: Hacked tif_jpeg.c to fetch TIFFTAG_YCBCRSUBSAMPLING from the jpeg data stream if it isn't - present in the tiff tags. + present in the tiff tags. http://bugzilla.remotesensing.org/show_bug.cgi?id=168 * libtiff/tif_read.c, libtiff/tif_write.c: TIFFReadScanline() and TIFFWriteScanline() now set tif_row explicitly in case the codec has - fooled with the value. + fooled with the value. http://bugzilla.remotesensing.org/show_bug.cgi?id=129 2002-06-22 Andrey Kiselev <dron@ak4719.spb.edu> - + * /tools/tiff2ps.c: Added workaround for some software that may crash when last strip of image contains fewer number of scanlines than specified by the `/Height' variable. See @@ -4723,8 +5609,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2002-06-11 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/contrib/win95: renamed to contrib/win_dib. Added new - Tiffile.cpp example of converting TIFF files into a DIB on Win32. + * libtiff/contrib/win95: renamed to contrib/win_dib. Added new + Tiffile.cpp example of converting TIFF files into a DIB on Win32. This one is described in: http://bugzilla.remotesensing.org/show_bug.cgi?id=143 @@ -4740,21 +5626,21 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=131 2002-04-26 Andrey Kiselev <dron@ak4719.spb.edu> - + * libtiff/libtiff.def: Added missed declaration. - + 2002-04-22 Andrey Kiselev <dron@ak4719.spb.edu> - + * tools/fax2tiff.c: Updated to reflect latest changes in libtiff. Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=125 2002-04-20 Andrey Kiselev <dron@ak4719.spb.edu> - + * libtiff/tif_open.c: Pointers to custom procedures in TIFFClientOpen() are checked to be not NULL-pointers. - + 2002-04-18 Andrey Kiselev <dron@ak4719.spb.edu> - + * libtiff/libtiff.def: Added missed declarations. * libtiff/tif_pixarlog.c: Updated for using tif_tagmethods structure. @@ -4764,14 +5650,14 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_lzw.c: Additional checks for data integrity introduced. Should finally close http://bugzilla.remotesensing.org/show_bug.cgi?id=100 - + 2002-04-10 Andrey Kiselev <dron@ak4719.spb.edu> * tools/tiff2ps: Division by zero fixed. Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=88 2002-04-09 Andrey Kiselev <dron@ak4719.spb.edu> - + * libtiff/: tif_dirwrite.c, tif_write.c, tiffio.h: TIFFCheckpointDirectory() routine added. Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=124 @@ -4803,7 +5689,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic replaced by warnings. Now libtiff should read corrupted LZW-compressed files by skipping bad strips. Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=100 - + 2002-04-03 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_dirwrite.c: Removed some dead code. @@ -4825,18 +5711,18 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=111 - * tif_print.c: Fixed so that ASCII FIELD_CUSTOM values with + * tif_print.c: Fixed so that ASCII FIELD_CUSTOM values with passcount set FALSE can be printed (such as TIFFTAG_SOFTWARE). - * libtiff/tif_dir.c,tif_dirinfo.c,tif_dir.h,tif_ojpeg.c: modified so + * libtiff/tif_dir.c,tif_dirinfo.c,tif_dir.h,tif_ojpeg.c: modified so that TIFFTAG_SOFTWARE uses FIELD_CUSTOM as an example. 2002-03-26 Dwight Kelly <dbmalloc@remotesensing.org> * libtiff/: tiff.h, tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c, tif_dirwrite.c: Added get/put code for new tag XMLPACKET as defined - in Adobe XMP Technote. Added missing INKSET tag value from TIFF 6.0 spec - INKSET_MULTIINK (=2). Added missing tags from Adobe TIFF technotes: + in Adobe XMP Technote. Added missing INKSET tag value from TIFF 6.0 spec + INKSET_MULTIINK (=2). Added missing tags from Adobe TIFF technotes: CLIPPATH, XCLIPPATHUNITS, YCLIPPATHUNITS, OPIIMAGEID, OPIPROXY and INDEXED. Added PHOTOMETRIC tag value from TIFF technote 4 ICCLAB (=9). @@ -4895,7 +5781,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=94 - * man/Makefile.in: Patch DESTDIR handling + * man/Makefile.in: Patch DESTDIR handling http://bugzilla.remotesensing.org/show_bug.cgi?id=95 @@ -4933,9 +5819,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2002-01-04 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: fixed computation of segment_width for - tiles files to avoid error about it not matching the - cinfo.d.image_width values ("JPEGPreDecode: Improper JPEG strip/tile + * libtiff/tif_jpeg.c: fixed computation of segment_width for + tiles files to avoid error about it not matching the + cinfo.d.image_width values ("JPEGPreDecode: Improper JPEG strip/tile size.") for ITIFF files. Apparently the problem was incorporated since 3.5.5, presumably during the OJPEG/JPEG work recently. @@ -4945,7 +5831,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=94 - * libtiff/tif_getimage.c: If DEFAULT_EXTRASAMPLE_AS_ALPHA is 1 + * libtiff/tif_getimage.c: If DEFAULT_EXTRASAMPLE_AS_ALPHA is 1 (defined in tiffconf.h - 1 by default) then the RGBA interface will assume that a fourth extra sample is ASSOCALPHA if the EXTRASAMPLE value isn't set for it. This changes the behaviour of @@ -4957,9 +5843,9 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-12-12 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: allow jpeg data stream sampling values to - override those from tiff directory. This makes this work with - ImageGear generated files. + * libtiff/tif_jpeg.c: allow jpeg data stream sampling values to + override those from tiff directory. This makes this work with + ImageGear generated files. 2001-12-07 Frank Warmerdam <warmerdam@pobox.com> @@ -4972,7 +5858,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * Reissue 3.5.7 release. * libtiff/mkversion.c: Fix output of TIFF_VERSION to be - YYYYMMDD so that it is increasing over time. + YYYYMMDD so that it is increasing over time. * Makefile.in: Ensure that tiffvers.h is regenerated in the make release target. @@ -4997,8 +5883,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-10-10 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tiff.h: I have created COMPRESSION_CCITT_T4, - COMPRESSION_CCITT_T6, TIFFTAG_T4OPTIONS and TIFFTAG_T6OPTIONS aliases + * libtiff/tiff.h: I have created COMPRESSION_CCITT_T4, + COMPRESSION_CCITT_T6, TIFFTAG_T4OPTIONS and TIFFTAG_T6OPTIONS aliases in keeping with TIFF 6.0 standard in tiff.h http://bugzilla.remotesensing.org/show_bug.cgi?id=83 @@ -5018,10 +5904,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic error about LZW not being available. * libtiff/tif_dir.c: propagate failure to initialize compression - back from TIFFSetField() as an error status, so applications can + back from TIFFSetField() as an error status, so applications can detect failure. - * libtiff/tif_dir.c: removed the auto replacement of + * libtiff/tif_dir.c: removed the auto replacement of COMPRESSION_LZW with COMPRESSION_NONE in _TIFFVSetField(). * Removed Makefile, tools/Makefile, port/install.sh, man/Makefile @@ -5029,7 +5915,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-09-22 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_ojpeg.c: new update from Scott. + * libtiff/tif_ojpeg.c: new update from Scott. 2001-09-09 Frank Warmerdam <warmerdam@pobox.com> @@ -5048,7 +5934,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic http://bugzilla.remotesensing.org/show_bug.cgi?id=47 - * tools/tiff2ps.c: added OJPEG YCbCr to RGB support. + * tools/tiff2ps.c: added OJPEG YCbCr to RGB support. * libtiff/tif_ojpeg.c: Applied substantial patch from Scott. @@ -5057,14 +5943,14 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_packbits.c: fixed memory overrun error. http://bugzilla.remotesensing.org/show_bug.cgi?id=77 - + 2001-08-31 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_getimage.c: relax handling of contig case where there are extra samples that are supposed to be ignored. This - should now work for 8bit greyscale or palletted images. + should now work for 8bit greyscale or palletted images. - http://bugzilla.remotesensing.org/show_bug.cgi?id=75 + http://bugzilla.remotesensing.org/show_bug.cgi?id=75 2001-08-28 Frank Warmerdam <warmerdam@pobox.com> @@ -5077,15 +5963,15 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_getimage.c: Use memmove() instead of TIFFmemcpy() in TIFFReadRGBATile() to avoid issues in cases of overlapping - buffers. See Bug 69 in Bugzilla. + buffers. See Bug 69 in Bugzilla. http://bugzilla.remotesensing.org/show_bug.cgi?id=69 - + * tools/tiff2rgba.c: fixed getopt() call so that -b works again. 2001-08-09 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tiff.h, libtiff/tif_fax3.c: added check for __LP64__ + * libtiff/tiff.h, libtiff/tif_fax3.c: added check for __LP64__ when checking for 64 bit architectures as per bugzilla bug 67. 2001-07-27 Frank Warmerdam <warmerdam@pobox.com> @@ -5095,7 +5981,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-07-20 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_jpeg.c: Define HAVE_BOOLEAN on windows if RPCNDR.H + * libtiff/tif_jpeg.c: Define HAVE_BOOLEAN on windows if RPCNDR.H has been included. 2001-07-19 Frank Warmerdam <warmerdam@pobox.com> @@ -5107,11 +5993,11 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_ojpeg.c: updates from Scott. Handles colors much better. Now depends on having patched libjpeg as per - patch in contrib/ojpeg/*. + patch in contrib/ojpeg/*. 2001-07-17 Frank Warmerdam <warmerdam@pobox.com> - * */Makefile.in: added DESTDIR support. + * */Makefile.in: added DESTDIR support. http://bugzilla.remotesensing.org/show_bug.cgi?id=60 @@ -5119,20 +6005,20 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * configure, libtiff/Makefile.in: applied OpenBSD patches as per: - + http://bugzilla.remotesensing.org/show_bug.cgi?id=61 2001-06-28 Frank Warmerdam <warmerdam@pobox.com> * libtiff/tif_getimage.c: Fixed so that failure is properly - reported by gtTileContig, gtStripContig, gtTileSeparate and + reported by gtTileContig, gtStripContig, gtTileSeparate and gtStripSeparate. See http://bugzilla.remotesensing.org/show_bug.cgi?id=51 - * tiffcmp.c: Fixed multi samples per pixel support for ContigCompare. + * tiffcmp.c: Fixed multi samples per pixel support for ContigCompare. Updated bug section of tiffcmp.1 to note tiled file issues. - + See http://bugzilla.remotesensing.org/show_bug.cgi?id=53 2001-06-22 Frank Warmerdam <warmerdam@pobox.com> @@ -5173,10 +6059,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-05-08 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tif_dirinfo.c: moved pixar and copyright flags to + * libtiff/tif_dirinfo.c: moved pixar and copyright flags to ensure everything is in order. - * libtiff/libtiff.def: added TIFFCreateDirectory and + * libtiff/libtiff.def: added TIFFCreateDirectory and TIFFDefaultStripSize as per: http://bugzilla.remotesensing.org/show_bug.cgi?id=46 @@ -5185,10 +6071,10 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirinfo.c: Modified the TIFF_BYTE definition for TIFFTAG_PHOTOSHOP to use a writecount of TIFF_VARIABLE2 (-3) to - force use of uint32 counts instead of short counts. + force use of uint32 counts instead of short counts. * libtiff/tif_dirwrite.c: Added support for TIFF_VARIABLE2 in the - case of writing TIFF_BYTE/TIFF_SBYTE fields. + case of writing TIFF_BYTE/TIFF_SBYTE fields. http://bugzilla.remotesensing.org/show_bug.cgi?id=43 @@ -5224,20 +6110,20 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic with the inttypes.h include file on AIX. See http://bugzilla.remotesensing.org/show_bug.cgi?id=39 - + * VERSION: update to 3.5.7 beta in preparation for release. * configure/config.site: modified to check if -lm is needed for MACHDEPLIBS if not supplied by config.site. Needed for Darwin. - * config.guess: updated wholesale to an FSF version apparently - from 1998 (as opposed to 1994). This is mainly inspired by + * config.guess: updated wholesale to an FSF version apparently + from 1998 (as opposed to 1994). This is mainly inspired by providing for MacOS X support. 2001-03-29 Frank Warmerdam <warmerdam@pobox.com> * configure, Makefile.in, etc: added support for OPTIMIZER being - set from config.site. + set from config.site. 2001-03-28 Frank Warmerdam <warmerdam@pobox.com> @@ -5256,7 +6142,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic (in particular short ones) print properly. See http://bugzilla.remotesensing.org/show_bug.cgi?id=35 - + * tiff2ps.c/tiff2ps.1: Substantial changes to tiff2ps by Bruce A. Mallett. See check message for detailed information on all the changes, including a faster encoder, fixes for level @@ -5264,7 +6150,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-03-27 Frank Warmerdam <warmerdam@pobox.com> - * libtiff/tiffio.h: Changed "#if LOGLUV_PUBLIC" to + * libtiff/tiffio.h: Changed "#if LOGLUV_PUBLIC" to "#ifdef LOGLUV_PUBLIC" so it will work with VisualAge on AIX. http://bugzilla.remotesensing.org/show_bug.cgi?id=39 @@ -5276,7 +6162,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-03-13 Frank Warmerdam <warmerdam@pobox.com> - * tif_getimage.c: Added support for 16bit minisblack/miniswhite + * tif_getimage.c: Added support for 16bit minisblack/miniswhite images in RGBA interface. 2001-03-02 Frank Warmerdam <warmerdam@pobox.com> @@ -5287,29 +6173,29 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * Brent Roman contributed updated tiffcp utility (and tiffcp.1) with support for extracting subimages with the ,n syntax, and also - adding the -b bias removal flag. + adding the -b bias removal flag. 2001-02-16 Frank Warmerdam <warmerdam@pobox.com> * libtiff/libtiff.def: Brent Roman submitted new version adding - serveral missing entry points. + serveral missing entry points. * libtiff/tif_dirinfo.c: don't declare tiffFieldInfo static on VMS. - Some sort of weird VMS thing. + Some sort of weird VMS thing. http://bugzilla.remotesensing.org/show_bug.cgi?id=31 - * tif_luv.c/tiff.h/tiffio.h: - New version of TIFF LogLuv (SGILOG) modules contributed by Greg Ward + * tif_luv.c/tiff.h/tiffio.h: + New version of TIFF LogLuv (SGILOG) modules contributed by Greg Ward (greg@shutterfly.com). He writes: 1) I improved the gamut-mapping function in tif_luv.c for imaginary - colors, because some images were being super-saturated on the input + colors, because some images were being super-saturated on the input side and this resulted in some strange color shifts in the output. 2) I added a psuedotag in tiff.h to control random dithering during - LogLuv encoding. This is turned off by default for 32-bit LogLuv and - on for 24-bit LogLuv output. Dithering improves the average color + LogLuv encoding. This is turned off by default for 32-bit LogLuv and + on for 24-bit LogLuv output. Dithering improves the average color accuracy over the image. 3) I added a #define for LOG_LUV_PUBLIC, which is enabled by default in @@ -5322,20 +6208,20 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2001-01-23 Frank Warmerdam <warmerdam@pobox.com> * tif_fax3.c: keep rw_mode flag internal to fax3 state to remember - whether we are encoding or decoding. This is to ensure graceful + whether we are encoding or decoding. This is to ensure graceful recovery if TIFFClientOpen() discovers an attempt to open a compressed - file for "r+" access, and subsequently close it, as it resets the + file for "r+" access, and subsequently close it, as it resets the tif_mode flag to O_RDONLY in this case to avoid writes, confusing the compressor's concept of whether it is in encode or decode mode. -2001-01-08 Mike Welles <mike@bangstate.com> +2001-01-08 Mike Welles <mike@bangstate.com> * Makefile.in: Now cleaning up after itself after creating the .tar.gz and .zip - + 2001-01-07 Frank Warmerdam <warmerdam@pobox.com> * html/libtiff.html: Fixed arguments in example for TIFFRGBAImageGet() - as per bug report by Patrick Connor. + as per bug report by Patrick Connor. 2000-12-28 Frank Warmerdam <warmerdam@pobox.com> @@ -5343,12 +6229,12 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * Fixed libtiff/makefile.vc to make tiffvers.h not version.h. -2000-12-22 Mike Welles <mike@bangstate.com> +2000-12-22 Mike Welles <mike@bangstate.com> * added link to CVS mirror from index.html - - * updated html/internals.html to note that LZW compression is - not supported by default. - + + * updated html/internals.html to note that LZW compression is + not supported by default. + 2000-12-22 Frank Warmerdam <warmerdam@pobox.com> * updated html/libtiff.html to not point at Niles' old JPL web site @@ -5360,19 +6246,19 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic Leonard Rosenthol <leonardr@lazerware.com>. May interfere with correct building on older systems. If so, please let me know. -2000-12-19 Mike Welles <mike@bangsate.com> +2000-12-19 Mike Welles <mike@bangsate.com> - * Took out LZW Encoding from tif_lzw.c + * Took out LZW Encoding from tif_lzw.c * Created HOWTO-RELEASE * Created html/v3.5.6.html * updated index.html - + 2000-12-01 Frank Warmerdam <warmerdam@pobox.com> - * Added patches for EOFB support in tif_fax3.c and tif_fax3.h. + * Added patches for EOFB support in tif_fax3.c and tif_fax3.h. Patches supplied by Frank Cringle <fdc@cliwe.ping.de> Example file at: ftp://ftp.remotesensing.org/pub/libtiff/eofb_396.tif @@ -5386,30 +6272,30 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic targets so libtiff.so will be built with an explicit dependency on libm.so. - * libtiff/Makefile.in: Use softlinks to link libtiff.so.3 to - libtiff.so.3.5.5. + * libtiff/Makefile.in: Use softlinks to link libtiff.so.3 to + libtiff.so.3.5.5. - * libtiff/Makefile.in & configure: Remove all references to the ALPHA - file, or ALPHA version logic. Added stuff about DIST_POINT in + * libtiff/Makefile.in & configure: Remove all references to the ALPHA + file, or ALPHA version logic. Added stuff about DIST_POINT in place of DIST_TYPE and the alpha release number stuff. 2000-11-22 Frank Warmerdam <warmerdam@pobox.com> * I have applied a patch from Steffen Moeller <moeller@ebi.ac.uk> to - the configure script so that it now accepts the --prefix, and - --exec-prefix directives. + the configure script so that it now accepts the --prefix, and + --exec-prefix directives. 2000-11-13 Frank Warmerdam <warmerda@cs46980-c> - * I have made a variety of modifications in an effort to ensure the + * I have made a variety of modifications in an effort to ensure the TIFFLIB_VERSION macro is automatically generated from the RELEASE-DATE - file which seems to be updated regularly. + file which seems to be updated regularly. - o mkversion.c now reads RELEASE-DATE and emits TIFFLIB_VERSION in - version include file. - o renamed version.h to tiffvers.h because we now have to install it - with the public libtiff include files. - o include tiffvers.h in tiffio.h. + o mkversion.c now reads RELEASE-DATE and emits TIFFLIB_VERSION in + version include file. + o renamed version.h to tiffvers.h because we now have to install it + with the public libtiff include files. + o include tiffvers.h in tiffio.h. o updated tif_version.c to use tiffvers.h. o Updated Makefile.in accordingly. @@ -5423,13 +6309,13 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic See http://bugzilla.remotesensing.org/show_bug.cgi?id=20 Some patches from Rick LaMont of Dot C Software. - * Modified tif_packbits.c encoder to avoid compressing more + * Modified tif_packbits.c encoder to avoid compressing more data than provided if rowsize doesn't factor into provided data (such as occurs for YCbCr). 2000-10-19 Frank Warmerdam <warmerda@cs46980-c> - * tools/rgb2ycbcr.c: fixed output strip size to account for vertical + * tools/rgb2ycbcr.c: fixed output strip size to account for vertical roundup if rows_per_strip not a multiple of vertical sample size. 2000-10-16 Frank Warmerdam <warmerda@cs46980-c> @@ -5445,8 +6331,8 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2000-10-12 Frank Warmerdam <warmerda@cs46980-c> * Modified tiff2bw to ensure portions add to 100%, and that - white is properly recovered. - + white is properly recovered. + See bug http://bugzilla.remotesensing.org/show_bug.cgi?id=15 Patch c/o Stanislav Brabec <utx@penguin.cz> @@ -5460,26 +6346,26 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic 2000-09-27 Frank Warmerdam <warmerda@cs46980-c> - * Added GNULDdso target an`d switched linux and freebsd to use it. + * Added GNULDdso target an`d switched linux and freebsd to use it. 2000-09-26 Frank Warmerdam <warmerda@cs46980-c> * Applied patch for 0x0000 sequences in tif_fax3.h's definition - of EXPAND1D() as per bug 11 (from Roman). + of EXPAND1D() as per bug 11 (from Roman). 2000-09-25 Frank Warmerdam <warmerda@cs46980-c> * Fixed tiffcomp.h to avoid win32 stuff if unix #defined, to improve cygwin compatibility. * Applied patch from Roman Shpount to tif_fax3.c. This seems to - be a proper fix to the buffer sizing problem. See + be a proper fix to the buffer sizing problem. See http://bugzilla.remotesensing.org/show_bug.cgi?id=11 * Fixed tif_getimage.c to fix overrun bug with YCbCr images without downsampling. http://bugzilla.remotesensing.org/show_bug.cgi?id=10 Thanks to Nick Lamb <njl98r@ecs.soton.ac.uk> for reporting the bug and proving the patch. - + 2000-09-18 Frank Warmerdam <warmerda@cs46980-c> * Fixed tif_jpeg.c so avoid destroying the decompressor before @@ -5509,15 +6395,15 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * Tentatively added support for SAMPLEFORMAT_COMPLEXIEEEFP, and SAMPLEFORMAT_COMPLEXINT. -2000-07-13 Mike Welles <mike@onshore.com> +2000-07-13 Mike Welles <mike@onshore.com> + + * index.html, bugs.html: added bugzilla info. - * index.html, bugs.html: added bugzilla info. - 2000-07-12 Frank Warmerdam <warmerda@rommel.atlsci.com> * tif_read.c: fix subtle bug with determining the number of rows for strips that are the last strip in a separation but - not the last strip of all in TIFFReadEncodedStrip(). + not the last strip of all in TIFFReadEncodedStrip(). * Applied 16/32 bit fix to tif_fax3.c. Fix supplied by Peter Skarpetis <peters@serendipity-software.com.au> @@ -5539,7 +6425,7 @@ btiff/tif_win32.c: Replace custom Win32 memory api with generic * libtiff/tif_dirread.c: Don't use estimate strip byte count for one tile/strip images with an offset, and byte count of zero. These - could be "unpopulated" images. + could be "unpopulated" images. 2000-04-18 Frank Warmerdam <warmerda@rommel.atlsci.com> @@ -5554,17 +6440,17 @@ Tue Apr 18 16:18:08 2000 Frank Warmerdam <warmerda@esabot.atlsci.com> 2000-04-12 Mike Welles <mike@onshore.com> * configure: Fixed stupid mistake in libc6 test on Linux -2000-04-04 Mike Welles <mike@onshore.com> +2000-04-04 Mike Welles <mike@onshore.com> * tif_win32.c: Applied patch to fix overreads and ovverwrites - caught by BoundsChecker. From Arvan Pritchard - <arvan.pritchard@infomatix.co.uk> (untested). - - * tif_getimage.c: Applied patch to silence VC6 warnings. From + caught by BoundsChecker. From Arvan Pritchard + <arvan.pritchard@infomatix.co.uk> (untested). + + * tif_getimage.c: Applied patch to silence VC6 warnings. From Arvan Pritchard <arvan.pritchard@informatix.co.uk> - - * tif_lzw.c: Applied patch to silence VC6 warnings. From + + * tif_lzw.c: Applied patch to silence VC6 warnings. From Arvan Pritchard <arvan.pritchard@informatix.co.uk> - + 2000-03-28 Frank Warmerdam <warmerda@cs46980-c> * Added contrib/stream (stream io) code submitted by Avi Bleiweiss. @@ -5574,34 +6460,34 @@ Tue Apr 18 16:18:08 2000 Frank Warmerdam <warmerda@esabot.atlsci.com> * fax2ps: Fixed mixup of width and height in bounding box statement as per submission by Nalin Dahyabhai <nalin@redhat.com>. -2000-03-27 Mike Welles <mike@onshore.com> +2000-03-27 Mike Welles <mike@onshore.com> + + * fax2ps: Modified printruns to take uint32 instead of uint16. + Patch courtesy of Bernt Herd <herd@herdsoft.com> - * fax2ps: Modified printruns to take uint32 instead of uint16. - Patch courtesy of Bernt Herd <herd@herdsoft.com> - -2000-03-20 Mike Welles <mike@onshore.com> +2000-03-20 Mike Welles <mike@onshore.com> - * configure: added test for libc6 for linux targets. Bug reported by + * configure: added test for libc6 for linux targets. Bug reported by Stanislav Brabec <utx@k332.feld.cvut.cz> - * Added 3.5 docs to html/Makefile.in. + * Added 3.5 docs to html/Makefile.in. Thanks to Stanislav Brabec <utx@k332.feld.cvut.cz> - * configure: fixed bugs in sed scripts - (applied sed script s:/@:s;@:;s:/s;;:;: to configure). + * configure: fixed bugs in sed scripts + (applied sed script s:/@:s;@:;s:/s;;:;: to configure). fix submitted to Stanislav Brabec <utx@k332.feld.cvut.cz> - * tools/iptcutil was not in files list, and wasn't being + * tools/iptcutil was not in files list, and wasn't being added to tar archive. Updated Makefile.in. 2000-03-17 Frank Warmerdam <warmerda@cs46980-c> * tif_fax3.c: Fixed serious bug introduced during the uint16->uint32 - conversion for the run arrays. + conversion for the run arrays. 2000-03-03 Frank Warmerdam <warmerda@cs46980-c.mtnk1.on.wave.home.com> - * Set td_sampleformat default to SAMPLEFORMAT_UINT instead of + * Set td_sampleformat default to SAMPLEFORMAT_UINT instead of SAMPLEFORMAT_VOID in TIFFDefaultDirectory() in tif_dir.c. 2000-03-02 Frank Warmerdam <warmerda@cs46980-c.mtnk1.on.wave.home.com> @@ -5622,20 +6508,20 @@ Tue Feb 15 22:01:05 2000 Frank Warmerdam <warmerda@gdal.velocet.ca> set to 1, and added default (off) setting in tiffconf.h. This should eventually be set by the configure script somehow. - The original work on all these 2-4GB changes was done by + The original work on all these 2-4GB changes was done by Peter Smith (psmith@creo.com). * Modified tif_win32.c to support 2-4GB seeks. * tentatively changed toff_t to be unsigned instead of signed to - facilitate support for 2-4GB files. + facilitate support for 2-4GB files. * Updated a variety of files to use toff_t. Fixed some mixups between toff_t and tsize_t. Fri Jan 28 10:13:49 2000 Frank Warmerdam <warmerda@gdal.velocet.ca> - * Largely reimplemented contrib/addtiffo to avoid temp files, + * Largely reimplemented contrib/addtiffo to avoid temp files, updating the TIFF file in place. Fixed a few other bugs to. * Set tif_rawdatasize to zero when freeing raw data buffer in @@ -5644,7 +6530,7 @@ Fri Jan 28 10:13:49 2000 Frank Warmerdam <warmerda@gdal.velocet.ca> * Enabled "REWRITE_HACK" in tif_write.c by default. * Fix bug in tif_write.c when switching between reading one directory - and writing to another. + and writing to another. * Made TIFFWriteCheck() public, and added TIFFCreateDirectory() @@ -5656,41 +6542,41 @@ Tue Jan 4 13:39:00 2000 Frank Warmerdam <warmerda@gdal.velocet.ca> * Added libtiff/libtiff.def to TIFFILES distribution list. -Mon Dec 27 12:13:39 EST 1999 Mike Welles <mike@onshore.com> +Mon Dec 27 12:13:39 EST 1999 Mike Welles <mike@onshore.com> - * Created lzw compression kit, as a new module (libtiff-lzw-compression-kit). + * Created lzw compression kit, as a new module (libtiff-lzw-compression-kit). * Altered descriptions in tools to reflect "by default" lzw not supported - * Updated index.html to note lzw compression kit. - + * Updated index.html to note lzw compression kit. + Tue Dec 21 14:01:51 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> - * Added fax3sm_winnt.c to distribution list in Makefile.in. + * Added fax3sm_winnt.c to distribution list in Makefile.in. Tue Dec 21 11:04:45 EST 1999 Mike Welles <mike@onshore.com> *** 3.5.4 release *** - - * Aadded Pixar tag support. Contributed by Phil Beffery <phil@pixar.com> - * Made one more change to tif_dir.c for removal of LZW compression. Also added notice - when LZW compression invoked. + * Aadded Pixar tag support. Contributed by Phil Beffery <phil@pixar.com> + + * Made one more change to tif_dir.c for removal of LZW compression. Also added notice + when LZW compression invoked. * Changed default compression in tools to TIFF_PACKBITS, and changed usage descriptions in tools to reflect removal of LZW compression - + Mon Dec 20 18:39:02 EST 1999 Mike Welles <mike@onshore.com> - * Fixed bug that caused LZW (non) compression to segfault. Added - warning about LZW compression removed being removed, and why. + * Fixed bug that caused LZW (non) compression to segfault. Added + warning about LZW compression removed being removed, and why. + + * Added nostrip to install in tools/Makefile.in so that debugging + symbols are kept. - * Added nostrip to install in tools/Makefile.in so that debugging - symbols are kept. - Tue Dec 7 12:04:47 EST 1999 Mike Welles <mike@onshore.com> - * Added patch from Ivo Penzar <ivo.penzar@infolink-software.com>, - supporting Adobe ZIP deflate. Untested. - + * Added patch from Ivo Penzar <ivo.penzar@infolink-software.com>, + supporting Adobe ZIP deflate. Untested. + Sat Dec 4 15:47:11 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> * Made Packbits the default compression in tools/tiff2rgba.c instead @@ -5700,12 +6586,12 @@ Tue Nov 30 14:41:43 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> *** 3.5 * Added tif_luv to contrib/djgpp/Makefile.lib. -Tue Nov 30 14:15:32 EST 1999 Mike Welles <mike@onshore.com> +Tue Nov 30 14:15:32 EST 1999 Mike Welles <mike@onshore.com> - * Added zip creation to relase makefile target + * Added zip creation to relase makefile target + + * Added html for TIFFWriteTile.3t man page. - * Added html for TIFFWriteTile.3t man page. - Tue Nov 30 09:20:16 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> * Added some changes to tif_write.c to support rewriting existing @@ -5718,26 +6604,26 @@ Mon Nov 29 11:43:42 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> Sun Nov 28 20:36:18 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> - * Added notes on use of makefile.vc in build.html, and fixed + * Added notes on use of makefile.vc in build.html, and fixed email subscription address. -199-11-28 Mike Welles <mike@onshore.com> +199-11-28 Mike Welles <mike@onshore.com> - * Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c + * Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c * Did some casts cleaning up to reduce compiler warnings in tif_fax3.c, - from Bruce Carmeron <cameron@petris.com> -- modifications of - changes made by Frank (sun cc still complained on cast). + from Bruce Carmeron <cameron@petris.com> -- modifications of + changes made by Frank (sun cc still complained on cast). * Added tiffconf.h to install target per request from Bill Radcliffe <billr@corbis.com>: "We need a way for ImageMagick to know features have been compiled into the TIFF library in order to - handle things properly". - + handle things properly". + Sat Nov 27 16:49:21 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> * fixed various VC++ warnings as suggested by Gilles Vollant - <info@winimage.com>. + <info@winimage.com>. Wed Nov 24 12:08:16 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> @@ -5746,59 +6632,59 @@ Wed Nov 24 12:08:16 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> 1999-11-22 Mike Welles <mike@onshore.com> * HTML-ized the man pages, added to html/man - - * Removed LZW Compression to comply with Unisys patent extortion. - -1999-09-29 Mike Welles <mike@onshore.com> - * Corrected one remaining 16 -> 32 bit value in tif_fax3.c, - From Ivo Penzar <ivo.penzar@infolink-software.com. + + * Removed LZW Compression to comply with Unisys patent extortion. + +1999-09-29 Mike Welles <mike@onshore.com> + * Corrected one remaining 16 -> 32 bit value in tif_fax3.c, + From Ivo Penzar <ivo.penzar@infolink-software.com. * Added patch from Ivo Penzar to have TiffAdvanceDirectory handle memory mapped files. <ivo.penzar@infolink-software.com> - + 1999-09-26 Mike Welles <mike@onshore.com> *** 3.5.2 release *** - * Corrected alpha versioning. + * Corrected alpha versioning. - * Removed distinction between alpha and release targets in Makefile.in. + * Removed distinction between alpha and release targets in Makefile.in. - * added release.stamp target, which tags cvs tree, and updates + * added release.stamp target, which tags cvs tree, and updates "RELEASE-DATE" - * added releasediff target, which diffs tree with source as of + * added releasediff target, which diffs tree with source as of date in "RELEASE-DATE" - - * Ticked up version to 3.5.2 (alpha 01 -- but I think we'll moving - away from alpha/non-alpha distinctions). - * updated html to reflect release - + * Ticked up version to 3.5.2 (alpha 01 -- but I think we'll moving + away from alpha/non-alpha distinctions). + + * updated html to reflect release + 1999-09-23 <warmerda@CS46980-B> * Set O_BINARY for tif_unix.c open() ... used on cygwin for instance. * Added CYGWIN case in configure. -Fri Sep 17 00:13:51 CEST 1999 Mike Welles <mike@onshore.com> +Fri Sep 17 00:13:51 CEST 1999 Mike Welles <mike@onshore.com> + + * Applied Francois Dagand's patch to handle fax decompression bug. + (sizes >= 65536 were failing) - * Applied Francois Dagand's patch to handle fax decompression bug. - (sizes >= 65536 were failing) - Tue Sep 14 21:31:43 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> - * Applied "a" mode fix to tif_win32.c/TIFFOpen() as suggested + * Applied "a" mode fix to tif_win32.c/TIFFOpen() as suggested by Christopher Lawton <clawton@mathworks.com> Wed Sep 8 08:19:18 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> - * Added IRIX/gcc, and OSF/1 4.x support on behalf of + * Added IRIX/gcc, and OSF/1 4.x support on behalf of Albert Chin-A-Young <china@thewrittenword.com> - * Added TIFFReassignTagToIgnore() API on behalf of + * Added TIFFReassignTagToIgnore() API on behalf of Bruce Cameron <cameron@petris.com>. Man page still pending. Wed Aug 25 11:39:07 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> - * Added test target in Makefile, test_pics.sh script and pics/*.rpt + * Added test target in Makefile, test_pics.sh script and pics/*.rpt files to provide for a rudimentary testsuite. * Added contrib/tags back from old distribution ... fixed up a bit. @@ -5806,7 +6692,7 @@ Wed Aug 25 11:39:07 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> 1999-08-16 <warmerda@CS46980-B> * Added simple makefile.vc makefiles for building with MS VC++ - on Windows NT/98/95 in console mode. Stuff in contrib/win* make give + on Windows NT/98/95 in console mode. Stuff in contrib/win* make give better solutions for some users. Mon Aug 16 21:52:11 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> @@ -5816,20 +6702,20 @@ Mon Aug 16 21:52:11 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> 1999-08-16 Michael L. Welles <mike@kurtz.fake> - * Updated html/index.html with anon CVS instructions. + * Updated html/index.html with anon CVS instructions. Mon Aug 16 13:18:41 1999 Frank Warmerdam <warmerda@gdal.velocet.ca> - * pre-remove so link before softlink in LINUXdso action in + * pre-remove so link before softlink in LINUXdso action in libtiff/Makefile.in to avoid failure on LINUXdso builds other than the first. * Fixed problem with cvtcmap() in tif_getimage.c modifying the colormaps owned by the TIFF handle itself when trying to fixup wrong (eight bit) colormaps. Corrected by maintaining a private copy of - the colormap. + the colormap. - * Added TIFFReadRGBATile()/TIFFReadRGBAStrip() support in + * Added TIFFReadRGBATile()/TIFFReadRGBAStrip() support in tif_getimage.c. * CVS Repository placed at remotesensing.org. ChangeLog added. diff --git a/src/3rdparty/libtiff/RELEASE-DATE b/src/3rdparty/libtiff/RELEASE-DATE index f0326d2..ae758a7 100644 --- a/src/3rdparty/libtiff/RELEASE-DATE +++ b/src/3rdparty/libtiff/RELEASE-DATE @@ -1 +1 @@ -20120922 +20150912 diff --git a/src/3rdparty/libtiff/VERSION b/src/3rdparty/libtiff/VERSION index c4e41f9..d13e837 100644 --- a/src/3rdparty/libtiff/VERSION +++ b/src/3rdparty/libtiff/VERSION @@ -1 +1 @@ -4.0.3 +4.0.6 diff --git a/src/3rdparty/libtiff/libtiff/libtiff.def b/src/3rdparty/libtiff/libtiff/libtiff.def index 892ad23..98228f1 100644 --- a/src/3rdparty/libtiff/libtiff/libtiff.def +++ b/src/3rdparty/libtiff/libtiff/libtiff.def @@ -1,158 +1,164 @@ -EXPORTS TIFFOpen - TIFFOpenW - TIFFGetVersion +EXPORTS TIFFAccessTagMethods + TIFFCIELabToRGBInit + TIFFCIELabToXYZ + TIFFCheckTile + TIFFCheckpointDirectory TIFFCleanup + TIFFClientOpen + TIFFClientdata TIFFClose + TIFFComputeStrip + TIFFComputeTile + TIFFCreateCustomDirectory + TIFFCreateDirectory + TIFFCreateEXIFDirectory + TIFFCurrentDirOffset + TIFFCurrentDirectory + TIFFCurrentRow + TIFFCurrentStrip + TIFFCurrentTile + TIFFDataWidth + TIFFDefaultStripSize + TIFFDefaultTileSize + TIFFError + TIFFErrorExt + TIFFFdOpen + TIFFFieldDataType + TIFFFieldName + TIFFFieldPassCount + TIFFFieldReadCount + TIFFFieldTag + TIFFFieldWithName + TIFFFieldWithTag + TIFFFieldWriteCount + TIFFFileName + TIFFFileno + TIFFFindCODEC + TIFFFindField TIFFFlush TIFFFlushData + TIFFFreeDirectory + TIFFGetBitRevTable + TIFFGetClientInfo + TIFFGetCloseProc + TIFFGetConfiguredCODECs TIFFGetField - TIFFVGetField TIFFGetFieldDefaulted - TIFFVGetFieldDefaulted - TIFFGetTagListEntry - TIFFGetTagListCount - TIFFReadDirectory - TIFFScanlineSize64 - TIFFScanlineSize - TIFFStripSize64 - TIFFStripSize - TIFFVStripSize64 - TIFFVStripSize - TIFFRawStripSize64 - TIFFRawStripSize - TIFFTileRowSize64 - TIFFTileRowSize - TIFFTileSize64 - TIFFTileSize - TIFFVTileSize64 - TIFFVTileSize - TIFFFileno - TIFFSetFileno + TIFFGetMapFileProc TIFFGetMode - TIFFIsTiled - TIFFIsByteSwapped + TIFFGetReadProc + TIFFGetSeekProc + TIFFGetSizeProc + TIFFGetTagListCount + TIFFGetTagListEntry + TIFFGetUnmapFileProc + TIFFGetVersion + TIFFGetWriteProc TIFFIsBigEndian + TIFFIsByteSwapped + TIFFIsCODECConfigured TIFFIsMSB2LSB + TIFFIsTiled TIFFIsUpSampled - TIFFCIELabToRGBInit - TIFFCIELabToXYZ - TIFFXYZToRGB - TIFFYCbCrToRGBInit - TIFFYCbCrtoRGB - TIFFCurrentRow - TIFFCurrentDirectory - TIFFCurrentStrip - TIFFCurrentTile - TIFFDataWidth - TIFFReadBufferSetup - TIFFWriteBufferSetup - TIFFSetupStrips TIFFLastDirectory - TIFFSetDirectory - TIFFSetSubDirectory - TIFFUnlinkDirectory - TIFFSetField - TIFFVSetField - TIFFCheckpointDirectory - TIFFWriteDirectory - TIFFRewriteDirectory + TIFFMergeFieldInfo + TIFFNumberOfDirectories + TIFFNumberOfStrips + TIFFNumberOfTiles + TIFFOpen + TIFFOpenW TIFFPrintDirectory - TIFFReadScanline - TIFFWriteScanline + TIFFRGBAImageBegin + TIFFRGBAImageEnd + TIFFRGBAImageGet + TIFFRGBAImageOK + TIFFRasterScanlineSize + TIFFRasterScanlineSize64 + TIFFRawStripSize + TIFFRawStripSize64 + TIFFReadBufferSetup + TIFFReadCustomDirectory + TIFFReadDirectory + TIFFReadEXIFDirectory + TIFFReadEncodedStrip + TIFFReadEncodedTile TIFFReadRGBAImage TIFFReadRGBAImageOriented - TIFFFdOpen - TIFFClientOpen - TIFFFileName - TIFFError - TIFFErrorExt - TIFFWarning - TIFFWarningExt + TIFFReadRGBAStrip + TIFFReadRGBATile + TIFFReadRawStrip + TIFFReadRawTile + TIFFReadScanline + TIFFReadTile + TIFFRegisterCODEC + TIFFReverseBits + TIFFRewriteDirectory + TIFFScanlineSize + TIFFScanlineSize64 + TIFFSetClientInfo + TIFFSetClientdata + TIFFSetCompressionScheme + TIFFSetDirectory TIFFSetErrorHandler TIFFSetErrorHandlerExt + TIFFSetField + TIFFSetFileName + TIFFSetFileno + TIFFSetMode + TIFFSetSubDirectory + TIFFSetTagExtender TIFFSetWarningHandler TIFFSetWarningHandlerExt - TIFFComputeTile - TIFFCheckTile - TIFFNumberOfTiles - TIFFReadTile - TIFFWriteTile - TIFFComputeStrip - TIFFNumberOfStrips - TIFFRGBAImageBegin - TIFFRGBAImageGet - TIFFRGBAImageEnd - TIFFReadEncodedStrip - TIFFReadRawStrip - TIFFReadEncodedTile - TIFFReadRawTile - TIFFReadRGBATile - TIFFReadRGBAStrip - TIFFWriteEncodedStrip - TIFFWriteRawStrip - TIFFWriteEncodedTile - TIFFWriteRawTile TIFFSetWriteOffset - TIFFSwabFloat - TIFFSwabDouble - TIFFSwabShort - TIFFSwabLong - TIFFSwabArrayOfShort - TIFFSwabArrayOfLong - TIFFSwabArrayOfFloat + TIFFSetupStrips + TIFFStripSize + TIFFStripSize64 TIFFSwabArrayOfDouble + TIFFSwabArrayOfFloat + TIFFSwabArrayOfLong + TIFFSwabArrayOfLong8 + TIFFSwabArrayOfShort TIFFSwabArrayOfTriples - TIFFReverseBits - TIFFGetBitRevTable - TIFFDefaultStripSize - TIFFDefaultTileSize - TIFFRasterScanlineSize64 - TIFFRasterScanlineSize - _TIFFmalloc - _TIFFrealloc - _TIFFfree - _TIFFmemset - _TIFFmemcpy - _TIFFmemcmp - _TIFFCheckMalloc - TIFFCreateDirectory - TIFFSetTagExtender - TIFFFieldWithName - TIFFFieldWithTag - TIFFFieldTag - TIFFFieldName - TIFFFieldDataType - TIFFFieldPassCount - TIFFFieldReadCount - TIFFFieldWriteCount - TIFFCurrentDirOffset - TIFFWriteCheck - TIFFRGBAImageOK - TIFFNumberOfDirectories - TIFFSetFileName - TIFFSetClientdata - TIFFSetMode - TIFFClientdata - TIFFGetReadProc - TIFFGetWriteProc - TIFFGetSeekProc - TIFFGetCloseProc - TIFFGetSizeProc - TIFFGetMapFileProc - TIFFGetUnmapFileProc - TIFFIsCODECConfigured - TIFFGetConfiguredCODECs - TIFFFindCODEC - TIFFRegisterCODEC - TIFFUnRegisterCODEC - TIFFFreeDirectory - TIFFReadCustomDirectory - TIFFReadEXIFDirectory - TIFFAccessTagMethods - TIFFGetClientInfo - TIFFSetClientInfo + TIFFSwabDouble + TIFFSwabFloat + TIFFSwabLong TIFFSwabLong8 - TIFFSwabArrayOfLong8 - TIFFFindField + TIFFSwabShort + TIFFTileRowSize + TIFFTileRowSize64 + TIFFTileSize + TIFFTileSize64 + TIFFUnRegisterCODEC + TIFFUnlinkDirectory TIFFUnsetField - TIFFMergeFieldInfo + TIFFVGetField + TIFFVGetFieldDefaulted + TIFFVSetField + TIFFVStripSize + TIFFVStripSize64 + TIFFVTileSize + TIFFVTileSize64 + TIFFWarning + TIFFWarningExt + TIFFWriteBufferSetup + TIFFWriteCheck + TIFFWriteCustomDirectory + TIFFWriteDirectory + TIFFWriteEncodedStrip + TIFFWriteEncodedTile + TIFFWriteRawStrip + TIFFWriteRawTile + TIFFWriteScanline + TIFFWriteTile + TIFFXYZToRGB + TIFFYCbCrToRGBInit + TIFFYCbCrtoRGB + _TIFFCheckMalloc + _TIFFCheckRealloc + _TIFFRewriteField + _TIFFfree + _TIFFmalloc + _TIFFmemcmp + _TIFFmemcpy + _TIFFmemset + _TIFFrealloc diff --git a/src/3rdparty/libtiff/libtiff/mkg3states.c b/src/3rdparty/libtiff/libtiff/mkg3states.c index 1df9ccc..16ad3c2 100644 --- a/src/3rdparty/libtiff/libtiff/mkg3states.c +++ b/src/3rdparty/libtiff/libtiff/mkg3states.c @@ -1,4 +1,4 @@ -/* "$Id: mkg3states.c,v 1.11 2010-03-10 18:56:48 bfriesen Exp $ */ +/* "$Id: mkg3states.c,v 1.12 2015-06-21 01:09:09 bfriesen Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -383,8 +383,11 @@ main(int argc, char* argv[]) FILE* fd; char* outputfile; int c; + +#if !HAVE_DECL_OPTARG extern int optind; extern char* optarg; +#endif while ((c = getopt(argc, argv, "c:s:bp")) != -1) switch (c) { diff --git a/src/3rdparty/libtiff/libtiff/tif_codec.c b/src/3rdparty/libtiff/libtiff/tif_codec.c index e201667..7cb46f6 100644 --- a/src/3rdparty/libtiff/libtiff/tif_codec.c +++ b/src/3rdparty/libtiff/libtiff/tif_codec.c @@ -1,4 +1,4 @@ -/* $Id: tif_codec.c,v 1.15 2010-12-14 12:53:00 dron Exp $ */ +/* $Id: tif_codec.c,v 1.17 2015-08-19 02:31:04 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -108,7 +108,7 @@ _notConfigured(TIFF* tif) const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression); char compression_code[20]; - sprintf( compression_code, "%d", tif->tif_dir.td_compression ); + sprintf(compression_code, "%d",tif->tif_dir.td_compression ); TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s compression support is not configured", c ? c->name : compression_code ); diff --git a/src/3rdparty/libtiff/libtiff/tif_config.h b/src/3rdparty/libtiff/libtiff/tif_config.h index 64ab64b..a6bf38c 100644 --- a/src/3rdparty/libtiff/libtiff/tif_config.h +++ b/src/3rdparty/libtiff/libtiff/tif_config.h @@ -38,6 +38,10 @@ /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. + */ +#define HAVE_DECL_OPTARG 0 + /* Define to 1 if you have the <dlfcn.h> header file. */ /* #undef HAVE_DLFCN_H */ @@ -49,6 +53,9 @@ /* Define to 1 if you have the `floor' function. */ /* #undef HAVE_FLOOR */ +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +/* #undef HAVE_FSEEKO */ + /* Define to 1 if you have the `getopt' function. */ /* #undef HAVE_GETOPT */ @@ -101,9 +108,6 @@ /* Define to 1 if you have the `c' library (-lc). */ /* #undef HAVE_LIBC */ -/* Define to 1 if you have the `m' library (-lm). */ -/* #undef HAVE_LIBM */ - /* Define to 1 if you have the <limits.h> header file. */ /* #undef HAVE_LIMITS_H */ @@ -142,6 +146,11 @@ /* Define to 1 if you have the `setmode' function. */ /* #undef HAVE_SETMODE */ +/* Define to 1 if you have the `snprintf' function. */ +#if defined(snprintf) || (!defined(_MSC_VER) || _MSC_VER >= 1900) +#define HAVE_SNPRINTF 1 +#endif + /* Define to 1 if you have the `sqrt' function. */ /* #undef HAVE_SQRT */ @@ -220,8 +229,7 @@ /* Support LogLuv high dynamic range encoding */ /* #undef LOGLUV_SUPPORT */ -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define to the sub-directory where libtool stores uninstalled libraries. */ /* #undef LT_OBJDIR */ /* Support LZMA2 compression */ @@ -236,9 +244,6 @@ /* Support NeXT 2-bit RLE algorithm */ /* #undef NEXT_SUPPORT */ -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - /* Support Old JPEG compresson (read-only) */ /* #undef OJPEG_SUPPORT */ @@ -261,7 +266,7 @@ /* #undef PACKAGE_URL */ /* Define to the version of this package. */ -#define PACKAGE_VERSION "4.0.3" +#define PACKAGE_VERSION "4.0.6" /* Support Macintosh PackBits algorithm */ /* #undef PACKBITS_SUPPORT */ @@ -285,6 +290,9 @@ /* The size of `signed short', as computed by sizeof. */ /* #undef SIZEOF_SIGNED_SHORT */ +/* The size of `size_t', as computed by sizeof. */ +/* #undef SIZEOF_SIZE_T */ + /* The size of `unsigned char *', as computed by sizeof. */ /* #undef SIZEOF_UNSIGNED_CHAR_P */ @@ -340,6 +348,12 @@ /* Pointer difference type */ #define TIFF_PTRDIFF_T ptrdiff_t +/* Size type formatter */ +/* #undef TIFF_SIZE_FORMAT */ + +/* Unsigned size type */ +/* #undef TIFF_SIZE_T */ + /* Signed size type formatter */ #if QT_POINTER_SIZE == 4 #define TIFF_SSIZE_FORMAT "%ld" @@ -404,6 +418,9 @@ /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ diff --git a/src/3rdparty/libtiff/libtiff/tif_config.h.in b/src/3rdparty/libtiff/libtiff/tif_config.h.in index b2cea35..a4b2e60 100644 --- a/src/3rdparty/libtiff/libtiff/tif_config.h.in +++ b/src/3rdparty/libtiff/libtiff/tif_config.h.in @@ -27,6 +27,10 @@ /* Define to 1 if you have the <assert.h> header file. */ #undef HAVE_ASSERT_H +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. + */ +#undef HAVE_DECL_OPTARG + /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H @@ -36,6 +40,9 @@ /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#undef HAVE_FSEEKO + /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT @@ -79,9 +86,6 @@ /* Define to 1 if you have the `lfind' function. */ #undef HAVE_LFIND -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H @@ -118,6 +122,9 @@ /* Define to 1 if you have the `setmode' function. */ #undef HAVE_SETMODE +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT @@ -194,8 +201,7 @@ /* Support LogLuv high dynamic range encoding */ #undef LOGLUV_SUPPORT -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Support LZMA2 compression */ @@ -210,9 +216,6 @@ /* Support NeXT 2-bit RLE algorithm */ #undef NEXT_SUPPORT -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - /* Support Old JPEG compresson (read-only) */ #undef OJPEG_SUPPORT @@ -259,6 +262,9 @@ /* The size of `signed short', as computed by sizeof. */ #undef SIZEOF_SIGNED_SHORT +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + /* The size of `unsigned char *', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_CHAR_P @@ -314,6 +320,12 @@ /* Pointer difference type */ #undef TIFF_PTRDIFF_T +/* Size type formatter */ +#undef TIFF_SIZE_FORMAT + +/* Unsigned size type */ +#undef TIFF_SIZE_T + /* Signed size type formatter */ #undef TIFF_SSIZE_FORMAT @@ -376,6 +388,9 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#undef _LARGEFILE_SOURCE + /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES diff --git a/src/3rdparty/libtiff/libtiff/tif_config.vc.h b/src/3rdparty/libtiff/libtiff/tif_config.vc.h index c297cf3..7e6c5c2 100644 --- a/src/3rdparty/libtiff/libtiff/tif_config.vc.h +++ b/src/3rdparty/libtiff/libtiff/tif_config.vc.h @@ -1,3 +1,6 @@ +#ifndef _TIF_CONFIG_H_ +#define _TIF_CONFIG_H_ + /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 @@ -26,6 +29,9 @@ /* Define to 1 if you have the `setmode' function. */ #define HAVE_SETMODE 1 +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. */ +#define HAVE_DECL_OPTARG 0 + /* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4 @@ -44,10 +50,64 @@ /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned __int64 +#if _WIN64 +/* + Windows 64-bit build +*/ + +/* Pointer difference type */ +# define TIFF_PTRDIFF_T TIFF_INT64_T + +/* The size of `size_t', as computed by sizeof. */ +# define SIZEOF_SIZE_T 8 + +/* Size type formatter */ +# define TIFF_SIZE_FORMAT TIFF_INT64_FORMAT + +/* Unsigned size type */ +# define TIFF_SIZE_T TIFF_UINT64_T + +/* Signed size type formatter */ +# define TIFF_SSIZE_FORMAT TIFF_INT64_FORMAT + +/* Signed size type */ +# define TIFF_SSIZE_T TIFF_INT64_T + +#else +/* + Windows 32-bit build +*/ + +/* Pointer difference type */ +# define TIFF_PTRDIFF_T signed int + +/* The size of `size_t', as computed by sizeof. */ +# define SIZEOF_SIZE_T 4 + +/* Size type formatter */ +# define TIFF_SIZE_FORMAT "%u" + +/* Size type formatter */ +# define TIFF_SIZE_FORMAT "%u" + +/* Unsigned size type */ +# define TIFF_SIZE_T unsigned int + +/* Signed size type formatter */ +# define TIFF_SSIZE_FORMAT "%d" + +/* Signed size type */ +# define TIFF_SSIZE_T signed int + +#endif + /* Set the native cpu bit order */ #define HOST_FILLORDER FILLORDER_LSB2MSB +/* Visual Studio 2015 / VC 14 / MSVC 19.00 finally has snprintf() */ +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf _snprintf +#endif /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ @@ -62,6 +122,10 @@ #endif #define lfind _lfind + +#pragma warning(disable : 4996) /* function deprecation warnings */ + +#endif /* _TIF_CONFIG_H_ */ /* * Local Variables: * mode: c diff --git a/src/3rdparty/libtiff/libtiff/tif_dir.c b/src/3rdparty/libtiff/libtiff/tif_dir.c index 8bf3ea7..73212c0 100644 --- a/src/3rdparty/libtiff/libtiff/tif_dir.c +++ b/src/3rdparty/libtiff/libtiff/tif_dir.c @@ -1,4 +1,4 @@ -/* $Id: tif_dir.c,v 1.113 2012-06-14 20:32:53 fwarmerdam Exp $ */ +/* $Id: tif_dir.c,v 1.121 2015-05-31 23:11:43 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -160,10 +160,12 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap) TIFFDirectory* td = &tif->tif_dir; int status = 1; uint32 v32, i, v; + double dblval; char* s; const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY); uint32 standard_tag = tag; - + if( fip == NULL ) /* cannot happen since OkToChangeTag() already checks it */ + return 0; /* * We want to force the custom code to be used for custom * fields even if the tag happens to match a well known @@ -283,10 +285,16 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap) setDoubleArrayOneValue(&td->td_smaxsamplevalue, va_arg(ap, double), td->td_samplesperpixel); break; case TIFFTAG_XRESOLUTION: - td->td_xresolution = (float) va_arg(ap, double); + dblval = va_arg(ap, double); + if( dblval < 0 ) + goto badvaluedouble; + td->td_xresolution = (float) dblval; break; case TIFFTAG_YRESOLUTION: - td->td_yresolution = (float) va_arg(ap, double); + dblval = va_arg(ap, double); + if( dblval < 0 ) + goto badvaluedouble; + td->td_yresolution = (float) dblval; break; case TIFFTAG_PLANARCONFIG: v = (uint16) va_arg(ap, uint16_vap); @@ -449,11 +457,11 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap) * happens, for example, when tiffcp is used to convert between * compression schemes and codec-specific tags are blindly copied. */ - if(fip == NULL || fip->field_bit != FIELD_CUSTOM) { + if(fip->field_bit != FIELD_CUSTOM) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Invalid %stag \"%s\" (not supported by codec)", tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", - fip ? fip->field_name : "Unknown"); + fip->field_name); status = 0; break; } @@ -693,6 +701,16 @@ badvalue32: va_end(ap); } return (0); +badvaluedouble: + { + const TIFFField* fip=TIFFFieldWithTag(tif,tag); + TIFFErrorExt(tif->tif_clientdata, module, + "%s: Bad value %f for \"%s\" tag", + tif->tif_name, dblval, + fip ? fip->field_name : "Unknown"); + va_end(ap); + } + return (0); } /* @@ -809,6 +827,8 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap) int ret_val = 1; uint32 standard_tag = tag; const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY); + if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */ + return 0; /* * We want to force the custom code to be used for custom @@ -1006,14 +1026,14 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap) * get a tag that is not valid for the image's * codec then we'll arrive here. */ - if( fip == NULL || fip->field_bit != FIELD_CUSTOM ) + if( fip->field_bit != FIELD_CUSTOM ) { TIFFErrorExt(tif->tif_clientdata, "_TIFFVGetField", "%s: Invalid %stag \"%s\" " "(not supported by codec)", tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", - fip ? fip->field_name : "Unknown"); + fip->field_name); ret_val = 0; break; } @@ -1302,8 +1322,20 @@ TIFFDefaultDirectory(TIFF* tif) tif->tif_tagmethods.printdir = NULL; /* * Give client code a chance to install their own - * tag extensions & methods, prior to compression overloads. + * tag extensions & methods, prior to compression overloads, + * but do some prior cleanup first. (http://trac.osgeo.org/gdal/ticket/5054) */ + if (tif->tif_nfieldscompat > 0) { + uint32 i; + + for (i = 0; i < tif->tif_nfieldscompat; i++) { + if (tif->tif_fieldscompat[i].allocated_size) + _TIFFfree(tif->tif_fieldscompat[i].fields); + } + _TIFFfree(tif->tif_fieldscompat); + tif->tif_nfieldscompat = 0; + tif->tif_fieldscompat = NULL; + } if (_TIFFextender) (*_TIFFextender)(tif); (void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); @@ -1344,6 +1376,7 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off) if (((uint64)poffa!=poff)||(poffb<poffa)||(poffb<(tmsize_t)sizeof(uint16))||(poffb>tif->tif_size)) { TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory count"); + *nextdir=0; return(0); } _TIFFmemcpy(&dircount,tif->tif_base+poffa,sizeof(uint16)); @@ -1453,7 +1486,8 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off) (void) TIFFSeekFile(tif, dircount16*20, SEEK_CUR); if (!ReadOK(tif, nextdir, sizeof (uint64))) { - TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link", + TIFFErrorExt(tif->tif_clientdata, module, + "%s: Error fetching directory link", tif->tif_name); return (0); } @@ -1470,6 +1504,7 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off) uint16 TIFFNumberOfDirectories(TIFF* tif) { + static const char module[] = "TIFFNumberOfDirectories"; uint64 nextdir; uint16 n; if (!(tif->tif_flags&TIFF_BIGTIFF)) @@ -1478,7 +1513,18 @@ TIFFNumberOfDirectories(TIFF* tif) nextdir = tif->tif_header.big.tiff_diroff; n = 0; while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL)) - n++; + { + if (n != 65535) { + ++n; + } + else + { + TIFFErrorExt(tif->tif_clientdata, module, + "Directory count exceeded 65535 limit," + " giving up on counting."); + return (65535); + } + } return (n); } diff --git a/src/3rdparty/libtiff/libtiff/tif_dirinfo.c b/src/3rdparty/libtiff/libtiff/tif_dirinfo.c index d319931..7db4bdb 100644 --- a/src/3rdparty/libtiff/libtiff/tif_dirinfo.c +++ b/src/3rdparty/libtiff/libtiff/tif_dirinfo.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirinfo.c,v 1.117 2012-08-19 16:56:34 bfriesen Exp $ */ +/* $Id: tif_dirinfo.c,v 1.121 2014-05-07 01:58:46 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -128,6 +128,8 @@ tiffFields[] = { { TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FieldOfViewCotangent", NULL }, { TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen", NULL }, { TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera", NULL }, + { TIFFTAG_CFAREPEATPATTERNDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CFARepeatPatternDim", NULL }, + { TIFFTAG_CFAPATTERN, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CFAPattern" , NULL}, { TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Copyright", NULL }, /* end Pixar tags */ { TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_LONG, 0, TIFF_SETGET_C32_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "RichTIFFIPTC", NULL }, @@ -193,19 +195,19 @@ tiffFields[] = { { TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL}, /* end DNG tags */ /* begin TIFF/FX tags */ - { TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "Indexed" }, - { TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GlobalParametersIFD", NULL }, - { TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ProfileType", NULL }, - { TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "FaxProfile", NULL }, - { TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CodingMethods", NULL }, - { TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "VersionYear", NULL }, - { TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ModeNumber", NULL }, - { TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Decode", NULL }, - { TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ImageBaseColor", NULL }, - { TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "T82Options", NULL }, - { TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "StripRowCounts", NULL }, - { TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ImageLayer", NULL }, - /* end DNG tags */ + { TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "Indexed", NULL }, + { TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GlobalParametersIFD", NULL }, + { TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ProfileType", NULL }, + { TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "FaxProfile", NULL }, + { TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CodingMethods", NULL }, + { TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "VersionYear", NULL }, + { TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ModeNumber", NULL }, + { TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Decode", NULL }, + { TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ImageBaseColor", NULL }, + { TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "T82Options", NULL }, + { TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "StripRowCounts", NULL }, + { TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ImageLayer", NULL }, + /* end TIFF/FX tags */ /* begin pseudo tags */ }; @@ -711,7 +713,7 @@ _TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type) * note that this name is a special sign to TIFFClose() and * _TIFFSetupFields() to free the field */ - sprintf(fld->field_name, "Tag %d", (int) tag); + snprintf(fld->field_name, 32, "Tag %d", (int) tag); return fld; } diff --git a/src/3rdparty/libtiff/libtiff/tif_dirread.c b/src/3rdparty/libtiff/libtiff/tif_dirread.c index 19a26e2..a0dc68b 100644 --- a/src/3rdparty/libtiff/libtiff/tif_dirread.c +++ b/src/3rdparty/libtiff/libtiff/tif_dirread.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirread.c,v 1.178 2012-08-19 16:56:34 bfriesen Exp $ */ +/* $Id: tif_dirread.c,v 1.191 2015-09-05 20:31:41 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -2172,11 +2172,6 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEn break; } _TIFFfree(origdata); - if (err!=TIFFReadDirEntryErrOk) - { - _TIFFfree(data); - return(err); - } *value=data; return(TIFFReadDirEntryErrOk); } @@ -2414,11 +2409,6 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt break; } _TIFFfree(origdata); - if (err!=TIFFReadDirEntryErrOk) - { - _TIFFfree(data); - return(err); - } *value=data; return(TIFFReadDirEntryErrOk); } @@ -2657,11 +2647,6 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value) break; } _TIFFfree(origdata); - if (err!=TIFFReadDirEntryErrOk) - { - _TIFFfree(data); - return(err); - } *value=data; return(TIFFReadDirEntryErrOk); } @@ -2723,11 +2708,6 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntr break; } _TIFFfree(origdata); - if (err!=TIFFReadDirEntryErrOk) - { - _TIFFfree(data); - return(err); - } *value=data; return(TIFFReadDirEntryErrOk); } @@ -3194,11 +3174,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32 value) /* * Largest 32-bit unsigned integer value. */ -#if defined(__WIN32__) && defined(_MSC_VER) -# define TIFF_UINT32_MAX 0xFFFFFFFFI64 -#else -# define TIFF_UINT32_MAX 0xFFFFFFFFLL -#endif +#define TIFF_UINT32_MAX 0xFFFFFFFFU static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongLong8(uint64 value) @@ -3212,7 +3188,7 @@ TIFFReadDirEntryCheckRangeLongLong8(uint64 value) static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong8(int64 value) { - if ((value<0) || (value > TIFF_UINT32_MAX)) + if ((value < 0) || (value > (int64) TIFF_UINT32_MAX)) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); @@ -3229,19 +3205,21 @@ TIFFReadDirEntryCheckRangeSlongLong(uint32 value) return(TIFFReadDirEntryErrOk); } +/* Check that the 8-byte unsigned value can fit in a 4-byte unsigned range */ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongLong8(uint64 value) { - if (value > 0x7FFFFFFFUL) + if (value > 0x7FFFFFFF) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); } +/* Check that the 8-byte signed value can fit in a 4-byte signed range */ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongSlong8(int64 value) { - if ((value < 0L-0x80000000L) || (value > 0x7FFFFFFFL)) + if ((value < 0-((int64) 0x7FFFFFFF+1)) || (value > 0x7FFFFFFF)) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); @@ -3286,11 +3264,7 @@ TIFFReadDirEntryCheckRangeLong8Slong8(int64 value) /* * Largest 64-bit signed integer value. */ -#if defined(__WIN32__) && defined(_MSC_VER) -# define TIFF_INT64_MAX 0x7FFFFFFFFFFFFFFFI64 -#else -# define TIFF_INT64_MAX 0x7FFFFFFFFFFFFFFFLL -#endif +#define TIFF_INT64_MAX ((int64)(((uint64) ~0) >> 1)) static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlong8Long8(uint64 value) @@ -3374,7 +3348,7 @@ static void TIFFReadDirEntryOutputErr(TIFF* tif, enum TIFFReadDirEntryErr err, c } else { switch (err) { case TIFFReadDirEntryErrCount: - TIFFErrorExt(tif->tif_clientdata, module, + TIFFWarningExt(tif->tif_clientdata, module, "Incorrect count for \"%s\"; tag ignored", tagname); break; @@ -3430,6 +3404,8 @@ TIFFReadDirectory(TIFF* tif) const TIFFField* fip; uint32 fii=FAILED_FII; toff_t nextdiroff; + int bitspersample_read = FALSE; + tif->tif_diroff=tif->tif_nextdiroff; if (!TIFFCheckDirOffset(tif,tif->tif_nextdiroff)) return 0; /* last offset or bad offset (IFD looping) */ @@ -3706,6 +3682,8 @@ TIFFReadDirectory(TIFF* tif) } if (!TIFFSetField(tif,dp->tdir_tag,value)) goto bad; + if( dp->tdir_tag == TIFFTAG_BITSPERSAMPLE ) + bitspersample_read = TRUE; } break; case TIFFTAG_SMINSAMPLEVALUE: @@ -3763,6 +3741,19 @@ TIFFReadDirectory(TIFF* tif) uint32 countrequired; uint32 incrementpersample; uint16* value=NULL; + /* It would be dangerous to instanciate those tag values */ + /* since if td_bitspersample has not yet been read (due to */ + /* unordered tags), it could be read afterwards with a */ + /* values greater than the default one (1), which may cause */ + /* crashes in user code */ + if( !bitspersample_read ) + { + fip = TIFFFieldWithTag(tif,dp->tdir_tag); + TIFFWarningExt(tif->tif_clientdata,module, + "Ignoring %s since BitsPerSample tag not found", + fip ? fip->field_name : "unknown tagname"); + continue; + } countpersample=(1L<<tif->tif_dir.td_bitspersample); if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64)countpersample)) { @@ -4278,7 +4269,8 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) TIFFDirectory *td = &tif->tif_dir; uint32 strip; - _TIFFFillStriles( tif ); + if( !_TIFFFillStriles( tif ) ) + return -1; if (td->td_stripbytecount) _TIFFfree(td->td_stripbytecount); @@ -4377,6 +4369,11 @@ TIFFCheckDirOffset(TIFF* tif, uint64 diroff) if (diroff == 0) /* no more directories */ return 0; + if (tif->tif_dirnumber == 65535) { + TIFFErrorExt(tif->tif_clientdata, "TIFFCheckDirOffset", + "Cannot handle more than 65535 TIFF directories"); + return 0; + } for (n = 0; n < tif->tif_dirnumber && tif->tif_dirlist; n++) { if (tif->tif_dirlist[n] == diroff) @@ -4396,7 +4393,10 @@ TIFFCheckDirOffset(TIFF* tif, uint64 diroff) tif->tif_dirnumber, 2 * sizeof(uint64), "for IFD list"); if (!new_dirlist) return 0; - tif->tif_dirlistsize = 2 * tif->tif_dirnumber; + if( tif->tif_dirnumber >= 32768 ) + tif->tif_dirlistsize = 65535; + else + tif->tif_dirlistsize = 2 * tif->tif_dirnumber; tif->tif_dirlist = new_dirlist; } @@ -4708,6 +4708,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) return 0; } fip=tif->tif_fields[fii]; + assert(fip != NULL); /* should not happen */ assert(fip->set_field_type!=TIFF_SETGET_OTHER); /* if so, we shouldn't arrive here but deal with this in specialized code */ assert(fip->set_field_type!=TIFF_SETGET_INT); /* if so, we shouldn't arrive here as this is only the case for pseudo-tags */ err=TIFFReadDirEntryErrOk; @@ -5355,7 +5356,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) } if (err!=TIFFReadDirEntryErrOk) { - TIFFReadDirEntryOutputErr(tif,err,module,fip ? fip->field_name : "unknown tagname",recover); + TIFFReadDirEntryOutputErr(tif,err,module,fip->field_name,recover); return(0); } return(1); diff --git a/src/3rdparty/libtiff/libtiff/tif_dirwrite.c b/src/3rdparty/libtiff/libtiff/tif_dirwrite.c index fa20609..a0fd8dc 100644 --- a/src/3rdparty/libtiff/libtiff/tif_dirwrite.c +++ b/src/3rdparty/libtiff/libtiff/tif_dirwrite.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirwrite.c,v 1.77 2012-07-06 19:18:31 bfriesen Exp $ */ +/* $Id: tif_dirwrite.c,v 1.78 2015-05-31 00:38:46 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -2839,14 +2839,15 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype, "Error writing directory link"); return (0); } - - _TIFFfree( buf_to_write ); } else { memcpy( &entry_offset, buf_to_write, count*TIFFDataWidth(datatype)); } + _TIFFfree( buf_to_write ); + buf_to_write = 0; + /* -------------------------------------------------------------------- */ /* Adjust the directory entry. */ /* -------------------------------------------------------------------- */ diff --git a/src/3rdparty/libtiff/libtiff/tif_fax3.c b/src/3rdparty/libtiff/libtiff/tif_fax3.c index 2b2dccd..bbe7255 100644 --- a/src/3rdparty/libtiff/libtiff/tif_fax3.c +++ b/src/3rdparty/libtiff/libtiff/tif_fax3.c @@ -1,4 +1,4 @@ -/* $Id: tif_fax3.c,v 1.74 2012-06-21 02:01:31 fwarmerdam Exp $ */ +/* $Id: tif_fax3.c,v 1.75 2015-08-30 20:49:55 erouault Exp $ */ /* * Copyright (c) 1990-1997 Sam Leffler @@ -442,8 +442,9 @@ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx) FILL(n, cp); run &= 7; } + /* Explicit 0xff masking to make icc -check=conversions happy */ if (run) - cp[0] |= 0xff00 >> run; + cp[0] = (unsigned char)((cp[0] | (0xff00 >> run))&0xff); } else cp[0] |= _fillmasks[run]>>bx; x += runs[1]; diff --git a/src/3rdparty/libtiff/libtiff/tif_getimage.c b/src/3rdparty/libtiff/libtiff/tif_getimage.c index a85273c..f49b73f 100644 --- a/src/3rdparty/libtiff/libtiff/tif_getimage.c +++ b/src/3rdparty/libtiff/libtiff/tif_getimage.c @@ -1,4 +1,4 @@ -/* $Id: tif_getimage.c,v 1.82 2012-06-06 00:17:49 fwarmerdam Exp $ */ +/* $Id: tif_getimage.c,v 1.90 2015-06-17 01:34:08 bfriesen Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -182,8 +182,23 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024]) "Planarconfiguration", td->td_planarconfig); return (0); } + if( td->td_samplesperpixel != 3 ) + { + sprintf(emsg, + "Sorry, can not handle image with %s=%d", + "Samples/pixel", td->td_samplesperpixel); + return 0; + } break; case PHOTOMETRIC_CIELAB: + if( td->td_samplesperpixel != 3 || td->td_bitspersample != 8 ) + { + sprintf(emsg, + "Sorry, can not handle image with %s=%d and %s=%d", + "Samples/pixel", td->td_samplesperpixel, + "Bits/sample", td->td_bitspersample); + return 0; + } break; default: sprintf(emsg, "Sorry, can not handle image with %s=%d", @@ -597,6 +612,10 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) int32 fromskew, toskew; uint32 nrow; int ret = 1, flip; + uint32 this_tw, tocol; + int32 this_toskew, leftmost_toskew; + int32 leftmost_fromskew; + uint32 leftmost_tw; buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif)); if (buf == 0) { @@ -617,37 +636,50 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) toskew = -(int32)(tw - w); } + /* + * Leftmost tile is clipped on left side if col_offset > 0. + */ + leftmost_fromskew = img->col_offset % tw; + leftmost_tw = tw - leftmost_fromskew; + leftmost_toskew = toskew + leftmost_fromskew; for (row = 0; row < h; row += nrow) { rowstoread = th - (row + img->row_offset) % th; nrow = (row + rowstoread > h ? h - row : rowstoread); - for (col = 0; col < w; col += tw) + fromskew = leftmost_fromskew; + this_tw = leftmost_tw; + this_toskew = leftmost_toskew; + tocol = 0; + col = img->col_offset; + while (tocol < w) { - if (TIFFReadTile(tif, buf, col+img->col_offset, + if (TIFFReadTile(tif, buf, col, row+img->row_offset, 0, 0)==(tmsize_t)(-1) && img->stoponerr) { ret = 0; break; } - - pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif); - - if (col + tw > w) - { - /* - * Tile is clipped horizontally. Calculate - * visible portion and skewing factors. - */ - uint32 npix = w - col; - fromskew = tw - npix; - (*put)(img, raster+y*w+col, col, y, - npix, nrow, fromskew, toskew + fromskew, buf + pos); - } - else - { - (*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos); - } - } + pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \ + ((tmsize_t) fromskew * img->samplesperpixel); + if (tocol + this_tw > w) + { + /* + * Rightmost tile is clipped on right side. + */ + fromskew = tw - (w - tocol); + this_tw = tw - fromskew; + this_toskew = toskew + fromskew; + } + (*put)(img, raster+y*w+tocol, tocol, y, this_tw, nrow, fromskew, this_toskew, buf + pos); + tocol += this_tw; + col += this_tw; + /* + * After the leftmost tile, tiles are no longer clipped on left side. + */ + fromskew = 0; + this_tw = tw; + this_toskew = toskew; + } y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); } @@ -698,6 +730,10 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) uint32 nrow; int ret = 1, flip; int colorchannels; + uint32 this_tw, tocol; + int32 this_toskew, leftmost_toskew; + int32 leftmost_fromskew; + uint32 leftmost_tw; tilesize = TIFFTileSize(tif); bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,tilesize); @@ -742,20 +778,31 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } + /* + * Leftmost tile is clipped on left side if col_offset > 0. + */ + leftmost_fromskew = img->col_offset % tw; + leftmost_tw = tw - leftmost_fromskew; + leftmost_toskew = toskew + leftmost_fromskew; for (row = 0; row < h; row += nrow) { rowstoread = th - (row + img->row_offset) % th; nrow = (row + rowstoread > h ? h - row : rowstoread); - for (col = 0; col < w; col += tw) + fromskew = leftmost_fromskew; + this_tw = leftmost_tw; + this_toskew = leftmost_toskew; + tocol = 0; + col = img->col_offset; + while (tocol < w) { - if (TIFFReadTile(tif, p0, col+img->col_offset, + if (TIFFReadTile(tif, p0, col, row+img->row_offset,0,0)==(tmsize_t)(-1) && img->stoponerr) { ret = 0; break; } if (colorchannels > 1 - && TIFFReadTile(tif, p1, col+img->col_offset, + && TIFFReadTile(tif, p1, col, row+img->row_offset,0,1) == (tmsize_t)(-1) && img->stoponerr) { @@ -763,7 +810,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } if (colorchannels > 1 - && TIFFReadTile(tif, p2, col+img->col_offset, + && TIFFReadTile(tif, p2, col, row+img->row_offset,0,2) == (tmsize_t)(-1) && img->stoponerr) { @@ -771,7 +818,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } if (alpha - && TIFFReadTile(tif,pa,col+img->col_offset, + && TIFFReadTile(tif,pa,col, row+img->row_offset,0,colorchannels) == (tmsize_t)(-1) && img->stoponerr) { @@ -779,23 +826,27 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } - pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif); - - if (col + tw > w) + pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \ + ((tmsize_t) fromskew * img->samplesperpixel); + if (tocol + this_tw > w) { /* - * Tile is clipped horizontally. Calculate - * visible portion and skewing factors. + * Rightmost tile is clipped on right side. */ - uint32 npix = w - col; - fromskew = tw - npix; - (*put)(img, raster+y*w+col, col, y, - npix, nrow, fromskew, toskew + fromskew, - p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); - } else { - (*put)(img, raster+y*w+col, col, y, - tw, nrow, 0, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); + fromskew = tw - (w - tocol); + this_tw = tw - fromskew; + this_toskew = toskew + fromskew; } + (*put)(img, raster+y*w+tocol, tocol, y, this_tw, nrow, fromskew, this_toskew, \ + p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); + tocol += this_tw; + col += this_tw; + /* + * After the leftmost tile, tiles are no longer clipped on left side. + */ + fromskew = 0; + this_tw = tw; + this_toskew = toskew; } y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow); @@ -842,6 +893,12 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) int32 fromskew, toskew; int ret = 1, flip; + TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver); + if( subsamplingver == 0 ) { + TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Invalid vertical YCbCr subsampling"); + return (0); + } + buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif)); if (buf == 0) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer"); @@ -859,7 +916,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) } TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); - TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver); + scanline = TIFFScanlineSize(tif); fromskew = (w < imagewidth ? imagewidth - w : 0); for (row = 0; row < h; row += nrow) @@ -879,7 +936,8 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } - pos = ((row + img->row_offset) % rowsperstrip) * scanline; + pos = ((row + img->row_offset) % rowsperstrip) * scanline + \ + ((tmsize_t) img->col_offset * img->samplesperpixel); (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); } @@ -1010,7 +1068,8 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) } } - pos = ((row + img->row_offset) % rowsperstrip) * scanline; + pos = ((row + img->row_offset) % rowsperstrip) * scanline + \ + ((tmsize_t) img->col_offset * img->samplesperpixel); (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); @@ -1852,7 +1911,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile) (void) y; fromskew = (fromskew * 10) / 4; - if ((h & 3) == 0 && (w & 1) == 0) { + if ((w & 3) == 0 && (h & 1) == 0) { for (; h >= 2; h -= 2) { x = w>>2; do { @@ -1929,7 +1988,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile) /* XXX adjust fromskew */ do { x = w>>2; - do { + while(x>0) { int32 Cb = pp[4]; int32 Cr = pp[5]; @@ -1940,7 +1999,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile) cp += 4; pp += 6; - } while (--x); + x--; + } if( (w&3) != 0 ) { @@ -2031,7 +2091,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile) fromskew = (fromskew * 4) / 2; do { x = w>>1; - do { + while(x>0) { int32 Cb = pp[2]; int32 Cr = pp[3]; @@ -2040,7 +2100,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile) cp += 2; pp += 4; - } while (--x); + x --; + } if( (w&1) != 0 ) { @@ -2541,7 +2602,7 @@ PickContigCase(TIFFRGBAImage* img) * must always be <= horizontal subsampling; so * there are only a few possibilities and we just * enumerate the cases. - * Joris: added support for the [1,2] case, nonetheless, to accomodate + * Joris: added support for the [1,2] case, nonetheless, to accommodate * some OJPEG files */ uint16 SubsamplingHor; diff --git a/src/3rdparty/libtiff/libtiff/tif_jpeg.c b/src/3rdparty/libtiff/libtiff/tif_jpeg.c index b61b91b..a970eb1 100644 --- a/src/3rdparty/libtiff/libtiff/tif_jpeg.c +++ b/src/3rdparty/libtiff/libtiff/tif_jpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_jpeg.c,v 1.111 2012-07-06 18:48:04 bfriesen Exp $ */ +/* $Id: tif_jpeg.c,v 1.119 2015-08-15 20:13:07 bfriesen Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler @@ -252,6 +252,9 @@ TIFFjpeg_create_compress(JPEGState* sp) sp->err.error_exit = TIFFjpeg_error_exit; sp->err.output_message = TIFFjpeg_output_message; + /* set client_data to avoid UMR warning from tools like Purify */ + sp->cinfo.c.client_data = NULL; + return CALLVJPEG(sp, jpeg_create_compress(&sp->cinfo.c)); } @@ -263,6 +266,9 @@ TIFFjpeg_create_decompress(JPEGState* sp) sp->err.error_exit = TIFFjpeg_error_exit; sp->err.output_message = TIFFjpeg_output_message; + /* set client_data to avoid UMR warning from tools like Purify */ + sp->cinfo.d.client_data = NULL; + return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d)); } @@ -658,7 +664,9 @@ alloc_downsampled_buffers(TIFF* tif, jpeg_component_info* comp_info, #define JPEG_MARKER_SOF0 0xC0 #define JPEG_MARKER_SOF1 0xC1 -#define JPEG_MARKER_SOF3 0xC3 +#define JPEG_MARKER_SOF2 0xC2 +#define JPEG_MARKER_SOF9 0xC9 +#define JPEG_MARKER_SOF10 0xCA #define JPEG_MARKER_DHT 0xC4 #define JPEG_MARKER_SOI 0xD8 #define JPEG_MARKER_SOS 0xDA @@ -729,6 +737,7 @@ JPEGFixupTagsSubsampling(TIFF* tif) _TIFFFillStriles( tif ); if( tif->tif_dir.td_stripbytecount == NULL + || tif->tif_dir.td_stripoffset == NULL || tif->tif_dir.td_stripbytecount[0] == 0 ) { /* Do not even try to check if the first strip/tile does not @@ -816,8 +825,11 @@ JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data) JPEGFixupTagsSubsamplingSkip(data,n); } break; - case JPEG_MARKER_SOF0: - case JPEG_MARKER_SOF1: + case JPEG_MARKER_SOF0: /* Baseline sequential Huffman */ + case JPEG_MARKER_SOF1: /* Extended sequential Huffman */ + case JPEG_MARKER_SOF2: /* Progressive Huffman: normally not allowed by TechNote, but that doesn't hurt supporting it */ + case JPEG_MARKER_SOF9: /* Extended sequential arithmetic */ + case JPEG_MARKER_SOF10: /* Progressive arithmetic: normally not allowed by TechNote, but that doesn't hurt supporting it */ /* this marker contains the subsampling factors we're scanning for */ { uint16 n; @@ -992,7 +1004,7 @@ JPEGSetupDecode(TIFF* tif) /* * Set up for decoding a strip or tile. */ -static int +/*ARGSUSED*/ static int JPEGPreDecode(TIFF* tif, uint16 s) { JPEGState *sp = JState(tif); @@ -1168,7 +1180,8 @@ JPEGPreDecode(TIFF* tif, uint16 s) * Decode a chunk of pixels. * "Standard" case: returned data is not downsampled. */ -/*ARGSUSED*/ static int +#if !JPEG_LIB_MK1_OR_12BIT +static int JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) { JPEGState *sp = JState(tif); @@ -1187,91 +1200,137 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) nrows = cc / sp->bytesperline; if (cc % sp->bytesperline) - TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read"); + TIFFWarningExt(tif->tif_clientdata, tif->tif_name, + "fractional scanline not read"); if( nrows > (tmsize_t) sp->cinfo.d.image_height ) nrows = sp->cinfo.d.image_height; /* data is expected to be read in multiples of a scanline */ if (nrows) - { - JSAMPROW line_work_buf = NULL; + { + do + { + /* + * In the libjpeg6b-9a 8bit case. We read directly into + * the TIFF buffer. + */ + JSAMPROW bufptr = (JSAMPROW)buf; - /* - * For 6B, only use temporary buffer for 12 bit imagery. - * For Mk1 always use it. - */ -#if !defined(JPEG_LIB_MK1) - if( sp->cinfo.d.data_precision == 12 ) -#endif - { - line_work_buf = (JSAMPROW) - _TIFFmalloc(sizeof(short) * sp->cinfo.d.output_width - * sp->cinfo.d.num_components ); - } + if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1) + return (0); - do { - if( line_work_buf != NULL ) - { - /* - * In the MK1 case, we aways read into a 16bit buffer, and then - * pack down to 12bit or 8bit. In 6B case we only read into 16 - * bit buffer for 12bit data, which we need to repack. - */ - if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1) - return (0); + ++tif->tif_row; + buf += sp->bytesperline; + cc -= sp->bytesperline; + } while (--nrows > 0); + } - if( sp->cinfo.d.data_precision == 12 ) - { - int value_pairs = (sp->cinfo.d.output_width - * sp->cinfo.d.num_components) / 2; - int iPair; + /* Update information on consumed data */ + tif->tif_rawcp = (uint8*) sp->src.next_input_byte; + tif->tif_rawcc = sp->src.bytes_in_buffer; + + /* Close down the decompressor if we've finished the strip or tile. */ + return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height + || TIFFjpeg_finish_decompress(sp); +} +#endif /* !JPEG_LIB_MK1_OR_12BIT */ - for( iPair = 0; iPair < value_pairs; iPair++ ) - { - unsigned char *out_ptr = - ((unsigned char *) buf) + iPair * 3; - JSAMPLE *in_ptr = line_work_buf + iPair * 2; +#if JPEG_LIB_MK1_OR_12BIT +/*ARGSUSED*/ static int +JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) +{ + JPEGState *sp = JState(tif); + tmsize_t nrows; + (void) s; - out_ptr[0] = (in_ptr[0] & 0xff0) >> 4; - out_ptr[1] = ((in_ptr[0] & 0xf) << 4) - | ((in_ptr[1] & 0xf00) >> 8); - out_ptr[2] = ((in_ptr[1] & 0xff) >> 0); - } - } - else if( sp->cinfo.d.data_precision == 8 ) - { - int value_count = (sp->cinfo.d.output_width - * sp->cinfo.d.num_components); - int iValue; + /* + ** Update available information, buffer may have been refilled + ** between decode requests + */ + sp->src.next_input_byte = (const JOCTET*) tif->tif_rawcp; + sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc; - for( iValue = 0; iValue < value_count; iValue++ ) - { - ((unsigned char *) buf)[iValue] = - line_work_buf[iValue] & 0xff; - } - } - } - else - { - /* - * In the libjpeg6b 8bit case. We read directly into the - * TIFF buffer. - */ - JSAMPROW bufptr = (JSAMPROW)buf; + if( sp->bytesperline == 0 ) + return 0; + + nrows = cc / sp->bytesperline; + if (cc % sp->bytesperline) + TIFFWarningExt(tif->tif_clientdata, tif->tif_name, + "fractional scanline not read"); - if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1) - return (0); - } + if( nrows > (tmsize_t) sp->cinfo.d.image_height ) + nrows = sp->cinfo.d.image_height; - ++tif->tif_row; - buf += sp->bytesperline; - cc -= sp->bytesperline; - } while (--nrows > 0); + /* data is expected to be read in multiples of a scanline */ + if (nrows) + { + JSAMPROW line_work_buf = NULL; - if( line_work_buf != NULL ) - _TIFFfree( line_work_buf ); - } + /* + * For 6B, only use temporary buffer for 12 bit imagery. + * For Mk1 always use it. + */ + if( sp->cinfo.d.data_precision == 12 ) + { + line_work_buf = (JSAMPROW) + _TIFFmalloc(sizeof(short) * sp->cinfo.d.output_width + * sp->cinfo.d.num_components ); + } + + do + { + if( line_work_buf != NULL ) + { + /* + * In the MK1 case, we aways read into a 16bit + * buffer, and then pack down to 12bit or 8bit. + * In 6B case we only read into 16 bit buffer + * for 12bit data, which we need to repack. + */ + if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1) + return (0); + + if( sp->cinfo.d.data_precision == 12 ) + { + int value_pairs = (sp->cinfo.d.output_width + * sp->cinfo.d.num_components) / 2; + int iPair; + + for( iPair = 0; iPair < value_pairs; iPair++ ) + { + unsigned char *out_ptr = + ((unsigned char *) buf) + iPair * 3; + JSAMPLE *in_ptr = line_work_buf + iPair * 2; + + out_ptr[0] = (in_ptr[0] & 0xff0) >> 4; + out_ptr[1] = ((in_ptr[0] & 0xf) << 4) + | ((in_ptr[1] & 0xf00) >> 8); + out_ptr[2] = ((in_ptr[1] & 0xff) >> 0); + } + } + else if( sp->cinfo.d.data_precision == 8 ) + { + int value_count = (sp->cinfo.d.output_width + * sp->cinfo.d.num_components); + int iValue; + + for( iValue = 0; iValue < value_count; iValue++ ) + { + ((unsigned char *) buf)[iValue] = + line_work_buf[iValue] & 0xff; + } + } + } + + ++tif->tif_row; + buf += sp->bytesperline; + cc -= sp->bytesperline; + } while (--nrows > 0); + + if( line_work_buf != NULL ) + _TIFFfree( line_work_buf ); + } /* Update information on consumed data */ tif->tif_rawcp = (uint8*) sp->src.next_input_byte; @@ -1279,8 +1338,9 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) /* Close down the decompressor if we've finished the strip or tile. */ return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height - || TIFFjpeg_finish_decompress(sp); + || TIFFjpeg_finish_decompress(sp); } +#endif /* JPEG_LIB_MK1_OR_12BIT */ /*ARGSUSED*/ static int DecodeRowError(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) @@ -1451,6 +1511,15 @@ unsuppress_quant_table (JPEGState* sp, int tblno) } static void +suppress_quant_table (JPEGState* sp, int tblno) +{ + JQUANT_TBL* qtbl; + + if ((qtbl = sp->cinfo.c.quant_tbl_ptrs[tblno]) != NULL) + qtbl->sent_table = TRUE; +} + +static void unsuppress_huff_table (JPEGState* sp, int tblno) { JHUFF_TBL* htbl; @@ -1461,6 +1530,17 @@ unsuppress_huff_table (JPEGState* sp, int tblno) htbl->sent_table = FALSE; } +static void +suppress_huff_table (JPEGState* sp, int tblno) +{ + JHUFF_TBL* htbl; + + if ((htbl = sp->cinfo.c.dc_huff_tbl_ptrs[tblno]) != NULL) + htbl->sent_table = TRUE; + if ((htbl = sp->cinfo.c.ac_huff_tbl_ptrs[tblno]) != NULL) + htbl->sent_table = TRUE; +} + static int prepare_JPEGTables(TIFF* tif) { @@ -1510,17 +1590,38 @@ JPEGSetupEncode(TIFF* tif) assert(sp != NULL); assert(!sp->cinfo.comm.is_decompressor); + sp->photometric = td->td_photometric; + /* * Initialize all JPEG parameters to default values. * Note that jpeg_set_defaults needs legal values for * in_color_space and input_components. */ - sp->cinfo.c.in_color_space = JCS_UNKNOWN; - sp->cinfo.c.input_components = 1; + if (td->td_planarconfig == PLANARCONFIG_CONTIG) { + sp->cinfo.c.input_components = td->td_samplesperpixel; + if (sp->photometric == PHOTOMETRIC_YCBCR) { + if (sp->jpegcolormode == JPEGCOLORMODE_RGB) { + sp->cinfo.c.in_color_space = JCS_RGB; + } else { + sp->cinfo.c.in_color_space = JCS_YCbCr; + } + } else { + if ((td->td_photometric == PHOTOMETRIC_MINISWHITE || td->td_photometric == PHOTOMETRIC_MINISBLACK) && td->td_samplesperpixel == 1) + sp->cinfo.c.in_color_space = JCS_GRAYSCALE; + else if (td->td_photometric == PHOTOMETRIC_RGB && td->td_samplesperpixel == 3) + sp->cinfo.c.in_color_space = JCS_RGB; + else if (td->td_photometric == PHOTOMETRIC_SEPARATED && td->td_samplesperpixel == 4) + sp->cinfo.c.in_color_space = JCS_CMYK; + else + sp->cinfo.c.in_color_space = JCS_UNKNOWN; + } + } else { + sp->cinfo.c.input_components = 1; + sp->cinfo.c.in_color_space = JCS_UNKNOWN; + } if (!TIFFjpeg_set_defaults(sp)) return (0); /* Set per-file parameters */ - sp->photometric = td->td_photometric; switch (sp->photometric) { case PHOTOMETRIC_YCBCR: sp->h_sampling = td->td_ycbcrsubsampling[0]; @@ -1680,10 +1781,7 @@ JPEGPreEncode(TIFF* tif, uint16 s) if (td->td_planarconfig == PLANARCONFIG_CONTIG) { sp->cinfo.c.input_components = td->td_samplesperpixel; if (sp->photometric == PHOTOMETRIC_YCBCR) { - if (sp->jpegcolormode == JPEGCOLORMODE_RGB) { - sp->cinfo.c.in_color_space = JCS_RGB; - } else { - sp->cinfo.c.in_color_space = JCS_YCbCr; + if (sp->jpegcolormode != JPEGCOLORMODE_RGB) { if (sp->h_sampling != 1 || sp->v_sampling != 1) downsampled_input = TRUE; } @@ -1696,21 +1794,11 @@ JPEGPreEncode(TIFF* tif, uint16 s) sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling; sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling; } else { - if ((td->td_photometric == PHOTOMETRIC_MINISWHITE || td->td_photometric == PHOTOMETRIC_MINISBLACK) && td->td_samplesperpixel == 1) - sp->cinfo.c.in_color_space = JCS_GRAYSCALE; - else if (td->td_photometric == PHOTOMETRIC_RGB && td->td_samplesperpixel == 3) - sp->cinfo.c.in_color_space = JCS_RGB; - else if (td->td_photometric == PHOTOMETRIC_SEPARATED && td->td_samplesperpixel == 4) - sp->cinfo.c.in_color_space = JCS_CMYK; - else - sp->cinfo.c.in_color_space = JCS_UNKNOWN; if (!TIFFjpeg_set_colorspace(sp, sp->cinfo.c.in_color_space)) return (0); /* jpeg_set_colorspace set all sampling factors to 1 */ } } else { - sp->cinfo.c.input_components = 1; - sp->cinfo.c.in_color_space = JCS_UNKNOWN; if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN)) return (0); sp->cinfo.c.comp_info[0].component_id = s; @@ -1725,14 +1813,30 @@ JPEGPreEncode(TIFF* tif, uint16 s) sp->cinfo.c.write_JFIF_header = FALSE; sp->cinfo.c.write_Adobe_marker = FALSE; /* set up table handling correctly */ - if (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE)) + /* calling TIFFjpeg_set_quality() causes quantization tables to be flagged */ + /* as being to be emitted, which we don't want in the JPEGTABLESMODE_QUANT */ + /* mode, so we must manually suppress them. However TIFFjpeg_set_quality() */ + /* should really be called when dealing with files with directories with */ + /* mixed qualities. see http://trac.osgeo.org/gdal/ticket/3539 */ + if (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE)) return (0); - if (! (sp->jpegtablesmode & JPEGTABLESMODE_QUANT)) { + if (sp->jpegtablesmode & JPEGTABLESMODE_QUANT) { + suppress_quant_table(sp, 0); + suppress_quant_table(sp, 1); + } + else { unsuppress_quant_table(sp, 0); unsuppress_quant_table(sp, 1); } if (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) + { + /* Explicit suppression is only needed if we did not go through the */ + /* prepare_JPEGTables() code path, which may be the case if updating */ + /* an existing file */ + suppress_huff_table(sp, 0); + suppress_huff_table(sp, 1); sp->cinfo.c.optimize_coding = FALSE; + } else sp->cinfo.c.optimize_coding = TRUE; if (downsampled_input) { @@ -1791,7 +1895,14 @@ JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) { line16_count = (sp->bytesperline * 2) / 3; line16 = (short *) _TIFFmalloc(sizeof(short) * line16_count); - // FIXME: undiagnosed malloc failure + if (!line16) + { + TIFFErrorExt(tif->tif_clientdata, + "JPEGEncode", + "Failed to allocate memory"); + + return 0; + } } while (nrows-- > 0) { @@ -1966,13 +2077,10 @@ JPEGCleanup(TIFF* tif) tif->tif_tagmethods.vgetfield = sp->vgetparent; tif->tif_tagmethods.vsetfield = sp->vsetparent; tif->tif_tagmethods.printdir = sp->printdir; - - if( sp != NULL ) { - if( sp->cinfo_initialized ) - TIFFjpeg_destroy(sp); /* release libjpeg resources */ - if (sp->jpegtables) /* tag value */ - _TIFFfree(sp->jpegtables); - } + if( sp->cinfo_initialized ) + TIFFjpeg_destroy(sp); /* release libjpeg resources */ + if (sp->jpegtables) /* tag value */ + _TIFFfree(sp->jpegtables); _TIFFfree(tif->tif_data); /* release local state */ tif->tif_data = NULL; @@ -2284,8 +2392,17 @@ here hopefully is harmless. */ sp->jpegtables_length = SIZE_OF_JPEGTABLES; sp->jpegtables = (void *) _TIFFmalloc(sp->jpegtables_length); - // FIXME: NULL-deref after malloc failure - _TIFFmemset(sp->jpegtables, 0, SIZE_OF_JPEGTABLES); + if (sp->jpegtables) + { + _TIFFmemset(sp->jpegtables, 0, SIZE_OF_JPEGTABLES); + } + else + { + TIFFErrorExt(tif->tif_clientdata, + "TIFFInitJPEG", + "Failed to allocate memory for JPEG tables"); + return 0; + } #undef SIZE_OF_JPEGTABLES } diff --git a/src/3rdparty/libtiff/libtiff/tif_luv.c b/src/3rdparty/libtiff/libtiff/tif_luv.c index eba6c08..4e328ba 100644 --- a/src/3rdparty/libtiff/libtiff/tif_luv.c +++ b/src/3rdparty/libtiff/libtiff/tif_luv.c @@ -1,4 +1,4 @@ -/* $Id: tif_luv.c,v 1.35 2011-04-02 20:54:09 bfriesen Exp $ */ +/* $Id: tif_luv.c,v 1.40 2015-06-21 01:09:09 bfriesen Exp $ */ /* * Copyright (c) 1997 Greg Ward Larson @@ -379,6 +379,9 @@ LogLuvDecodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { tmsize_t rowlen = TIFFScanlineSize(tif); + if (rowlen == 0) + return 0; + assert(cc%rowlen == 0); while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) bp += rowlen, cc -= rowlen; @@ -395,6 +398,9 @@ LogLuvDecodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { tmsize_t rowlen = TIFFTileRowSize(tif); + if (rowlen == 0) + return 0; + assert(cc%rowlen == 0); while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) bp += rowlen, cc -= rowlen; @@ -644,6 +650,9 @@ LogLuvEncodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { tmsize_t rowlen = TIFFScanlineSize(tif); + if (rowlen == 0) + return 0; + assert(cc%rowlen == 0); while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) bp += rowlen, cc -= rowlen; @@ -659,6 +668,9 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { tmsize_t rowlen = TIFFTileRowSize(tif); + if (rowlen == 0) + return 0; + assert(cc%rowlen == 0); while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) bp += rowlen, cc -= rowlen; @@ -683,7 +695,9 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif +#undef log2 /* Conflict with C'99 function */ #define log2(x) ((1./M_LN2)*log(x)) +#undef exp2 /* Conflict with C'99 function */ #define exp2(x) exp(M_LN2*(x)) #define itrunc(x,m) ((m)==SGILOGENCODE_NODITHER ? \ diff --git a/src/3rdparty/libtiff/libtiff/tif_lzw.c b/src/3rdparty/libtiff/libtiff/tif_lzw.c index fd9c7a0..9b76dd0 100644 --- a/src/3rdparty/libtiff/libtiff/tif_lzw.c +++ b/src/3rdparty/libtiff/libtiff/tif_lzw.c @@ -1,4 +1,4 @@ -/* $Id: tif_lzw.c,v 1.45 2011-04-02 20:54:09 bfriesen Exp $ */ +/* $Id: tif_lzw.c,v 1.49 2015-08-30 21:07:44 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -94,7 +94,7 @@ typedef struct { unsigned short nbits; /* # of bits/code */ unsigned short maxcode; /* maximum code for lzw_nbits */ unsigned short free_ent; /* next free entry in hash table */ - long nextdata; /* next bits of i/o */ + unsigned long nextdata; /* next bits of i/o */ long nextbits; /* # of valid bits in lzw_nextdata */ int rw_mode; /* preserve rw_mode from init */ @@ -268,6 +268,8 @@ LZWPreDecode(TIFF* tif, uint16 s) if( sp->dec_codetab == NULL ) { tif->tif_setupdecode( tif ); + if( sp->dec_codetab == NULL ) + return (0); } /* @@ -365,7 +367,8 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) unsigned char *bp; hcode_t code; int len; - long nbits, nextbits, nextdata, nbitsmask; + long nbits, nextbits, nbitsmask; + unsigned long nextdata; code_t *codep, *free_entp, *maxcodep, *oldcodep; (void) s; @@ -434,16 +437,18 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) if (code == CODE_EOI) break; if (code == CODE_CLEAR) { - free_entp = sp->dec_codetab + CODE_FIRST; - _TIFFmemset(free_entp, 0, - (CSIZE - CODE_FIRST) * sizeof (code_t)); - nbits = BITS_MIN; - nbitsmask = MAXCODE(BITS_MIN); - maxcodep = sp->dec_codetab + nbitsmask-1; - NextCode(tif, sp, bp, code, GetNextCode); + do { + free_entp = sp->dec_codetab + CODE_FIRST; + _TIFFmemset(free_entp, 0, + (CSIZE - CODE_FIRST) * sizeof (code_t)); + nbits = BITS_MIN; + nbitsmask = MAXCODE(BITS_MIN); + maxcodep = sp->dec_codetab + nbitsmask-1; + NextCode(tif, sp, bp, code, GetNextCode); + } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */ if (code == CODE_EOI) break; - if (code >= CODE_CLEAR) { + if (code > CODE_CLEAR) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); @@ -653,16 +658,18 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) if (code == CODE_EOI) break; if (code == CODE_CLEAR) { - free_entp = sp->dec_codetab + CODE_FIRST; - _TIFFmemset(free_entp, 0, - (CSIZE - CODE_FIRST) * sizeof (code_t)); - nbits = BITS_MIN; - nbitsmask = MAXCODE(BITS_MIN); - maxcodep = sp->dec_codetab + nbitsmask; - NextCode(tif, sp, bp, code, GetNextCodeCompat); + do { + free_entp = sp->dec_codetab + CODE_FIRST; + _TIFFmemset(free_entp, 0, + (CSIZE - CODE_FIRST) * sizeof (code_t)); + nbits = BITS_MIN; + nbitsmask = MAXCODE(BITS_MIN); + maxcodep = sp->dec_codetab + nbitsmask; + NextCode(tif, sp, bp, code, GetNextCodeCompat); + } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */ if (code == CODE_EOI) break; - if (code >= CODE_CLEAR) { + if (code > CODE_CLEAR) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); @@ -830,13 +837,15 @@ LZWPreEncode(TIFF* tif, uint16 s) } else \ rat = (incount<<8) / outcount; \ } + +/* Explicit 0xff masking to make icc -check=conversions happy */ #define PutNextCode(op, c) { \ nextdata = (nextdata << nbits) | c; \ nextbits += nbits; \ - *op++ = (unsigned char)(nextdata >> (nextbits-8)); \ + *op++ = (unsigned char)((nextdata >> (nextbits-8))&0xff); \ nextbits -= 8; \ if (nextbits >= 8) { \ - *op++ = (unsigned char)(nextdata >> (nextbits-8)); \ + *op++ = (unsigned char)((nextdata >> (nextbits-8))&0xff); \ nextbits -= 8; \ } \ outcount += nbits; \ @@ -866,7 +875,8 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) hcode_t ent; long disp; long incount, outcount, checkpoint; - long nextdata, nextbits; + unsigned long nextdata; + long nextbits; int free_ent, maxcode, nbits; uint8* op; uint8* limit; @@ -1028,7 +1038,7 @@ LZWPostEncode(TIFF* tif) register LZWCodecState *sp = EncoderState(tif); uint8* op = tif->tif_rawcp; long nextbits = sp->lzw_nextbits; - long nextdata = sp->lzw_nextdata; + unsigned long nextdata = sp->lzw_nextdata; long outcount = sp->enc_outcount; int nbits = sp->lzw_nbits; @@ -1042,8 +1052,9 @@ LZWPostEncode(TIFF* tif) sp->enc_oldcode = (hcode_t) -1; } PutNextCode(op, CODE_EOI); + /* Explicit 0xff masking to make icc -check=conversions happy */ if (nextbits > 0) - *op++ = (unsigned char)(nextdata << (8-nextbits)); + *op++ = (unsigned char)((nextdata << (8-nextbits))&0xff); tif->tif_rawcc = (tmsize_t)(op - tif->tif_rawdata); return (1); } diff --git a/src/3rdparty/libtiff/libtiff/tif_next.c b/src/3rdparty/libtiff/libtiff/tif_next.c index 524e127..17e0311 100644 --- a/src/3rdparty/libtiff/libtiff/tif_next.c +++ b/src/3rdparty/libtiff/libtiff/tif_next.c @@ -1,4 +1,4 @@ -/* $Id: tif_next.c,v 1.13 2010-03-10 18:56:48 bfriesen Exp $ */ +/* $Id: tif_next.c,v 1.16 2014-12-29 12:09:11 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -71,7 +71,7 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read"); return (0); } - for (row = buf; occ > 0; occ -= scanline, row += scanline) { + for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) { n = *bp++, cc--; switch (n) { case LITERALROW: @@ -90,6 +90,8 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) * The scanline has a literal span that begins at some * offset. */ + if( cc < 4 ) + goto bad; off = (bp[0] * 256) + bp[1]; n = (bp[2] * 256) + bp[3]; if (cc < 4+n || off+n > scanline) @@ -102,6 +104,8 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) default: { uint32 npixels = 0, grey; uint32 imagewidth = tif->tif_dir.td_imagewidth; + if( isTiled(tif) ) + imagewidth = tif->tif_dir.td_tilewidth; /* * The scanline is composed of a sequence of constant @@ -139,10 +143,27 @@ bad: return (0); } +static int +NeXTPreDecode(TIFF* tif, uint16 s) +{ + static const char module[] = "NeXTPreDecode"; + TIFFDirectory *td = &tif->tif_dir; + (void)s; + + if( td->td_bitspersample != 2 ) + { + TIFFErrorExt(tif->tif_clientdata, module, "Unsupported BitsPerSample = %d", + td->td_bitspersample); + return (0); + } + return (1); +} + int TIFFInitNeXT(TIFF* tif, int scheme) { (void) scheme; + tif->tif_predecode = NeXTPreDecode; tif->tif_decoderow = NeXTDecode; tif->tif_decodestrip = NeXTDecode; tif->tif_decodetile = NeXTDecode; diff --git a/src/3rdparty/libtiff/libtiff/tif_ojpeg.c b/src/3rdparty/libtiff/libtiff/tif_ojpeg.c index 6ea3c38..23d4062 100644 --- a/src/3rdparty/libtiff/libtiff/tif_ojpeg.c +++ b/src/3rdparty/libtiff/libtiff/tif_ojpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_ojpeg.c,v 1.56 2012-05-24 03:15:18 fwarmerdam Exp $ */ +/* $Id: tif_ojpeg.c,v 1.60 2015-05-31 00:38:46 bfriesen Exp $ */ /* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0 specification is now totally obsolete and deprecated for new applications and @@ -39,7 +39,7 @@ OF THIS SOFTWARE. Joris Van Damme and/or AWare Systems may be available for custom - developement. If you like what you see, and need anything similar or related, + development. If you like what you see, and need anything similar or related, contact <info@awaresystems.be>. */ @@ -141,7 +141,7 @@ * OJPEG_BUFFER: Define the size of the desired buffer here. Should be small enough so as to guarantee * instant processing, optimal streaming and optimal use of processor cache, but also big * enough so as to not result in significant call overhead. It should be at least a few - * bytes to accomodate some structures (this is verified in asserts), but it would not be + * bytes to accommodate some structures (this is verified in asserts), but it would not be * sensible to make it this small anyway, and it should be at most 64K since it is indexed * with uint16. We recommend 2K. * EGYPTIANWALK: You could also define EGYPTIANWALK here, but it is not used anywhere and has @@ -528,6 +528,8 @@ OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap) uint32 ma; uint64* mb; uint32 n; + const TIFFField* fip; + switch(tag) { case TIFFTAG_JPEGIFOFFSET: @@ -597,7 +599,10 @@ OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap) default: return (*sp->vsetparent)(tif,tag,ap); } - TIFFSetFieldBit(tif,TIFFFieldWithTag(tif,tag)->field_bit); + fip = TIFFFieldWithTag(tif,tag); + if( fip == NULL ) /* shouldn't happen */ + return(0); + TIFFSetFieldBit(tif,fip->field_bit); tif->tif_flags|=TIFF_DIRTYDIRECT; return(1); } @@ -1492,14 +1497,17 @@ OJPEGReadHeaderInfoSecStreamDht(TIFF* tif) nb[sizeof(uint32)+1]=JPEG_MARKER_DHT; nb[sizeof(uint32)+2]=(m>>8); nb[sizeof(uint32)+3]=(m&255); - if (OJPEGReadBlock(sp,m-2,&nb[sizeof(uint32)+4])==0) + if (OJPEGReadBlock(sp,m-2,&nb[sizeof(uint32)+4])==0) { + _TIFFfree(nb); return(0); + } o=nb[sizeof(uint32)+4]; if ((o&240)==0) { if (3<o) { TIFFErrorExt(tif->tif_clientdata,module,"Corrupt DHT marker in JPEG data"); + _TIFFfree(nb); return(0); } if (sp->dctable[o]!=0) @@ -1511,12 +1519,14 @@ OJPEGReadHeaderInfoSecStreamDht(TIFF* tif) if ((o&240)!=16) { TIFFErrorExt(tif->tif_clientdata,module,"Corrupt DHT marker in JPEG data"); + _TIFFfree(nb); return(0); } o&=15; if (3<o) { TIFFErrorExt(tif->tif_clientdata,module,"Corrupt DHT marker in JPEG data"); + _TIFFfree(nb); return(0); } if (sp->actable[o]!=0) @@ -1955,6 +1965,7 @@ OJPEGReadBufferFill(OJPEGState* sp) break; case osibsJpegInterchangeFormat: sp->in_buffer_source=osibsStrile; + break; case osibsStrile: if (!_TIFFFillStriles( sp->tif ) || sp->tif->tif_dir.td_stripoffset == NULL diff --git a/src/3rdparty/libtiff/libtiff/tif_pixarlog.c b/src/3rdparty/libtiff/libtiff/tif_pixarlog.c index e583117..044c411 100644 --- a/src/3rdparty/libtiff/libtiff/tif_pixarlog.c +++ b/src/3rdparty/libtiff/libtiff/tif_pixarlog.c @@ -1,4 +1,4 @@ -/* $Id: tif_pixarlog.c,v 1.38 2012-06-21 01:01:53 fwarmerdam Exp $ */ +/* $Id: tif_pixarlog.c,v 1.39 2012-12-10 17:27:13 tgl Exp $ */ /* * Copyright (c) 1996-1997 Sam Leffler @@ -644,6 +644,20 @@ multiply_ms(tmsize_t m1, tmsize_t m2) return bytes; } +static tmsize_t +add_ms(tmsize_t m1, tmsize_t m2) +{ + tmsize_t bytes = m1 + m2; + + /* if either input is zero, assume overflow already occurred */ + if (m1 == 0 || m2 == 0) + bytes = 0; + else if (bytes <= m1 || bytes <= m2) + bytes = 0; + + return bytes; +} + static int PixarLogFixupTags(TIFF* tif) { @@ -671,9 +685,11 @@ PixarLogSetupDecode(TIFF* tif) td->td_samplesperpixel : 1); tbuf_size = multiply_ms(multiply_ms(multiply_ms(sp->stride, td->td_imagewidth), td->td_rowsperstrip), sizeof(uint16)); + /* add one more stride in case input ends mid-stride */ + tbuf_size = add_ms(tbuf_size, sizeof(uint16) * sp->stride); if (tbuf_size == 0) return (0); /* TODO: this is an error return without error report through TIFFErrorExt */ - sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size+sizeof(uint16)*sp->stride); + sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size); if (sp->tbuf == NULL) return (0); if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) diff --git a/src/3rdparty/libtiff/libtiff/tif_predict.c b/src/3rdparty/libtiff/libtiff/tif_predict.c index f93c664..1388dde 100644 --- a/src/3rdparty/libtiff/libtiff/tif_predict.c +++ b/src/3rdparty/libtiff/libtiff/tif_predict.c @@ -1,4 +1,4 @@ -/* $Id: tif_predict.c,v 1.32 2010-03-10 18:56:49 bfriesen Exp $ */ +/* $Id: tif_predict.c,v 1.35 2015-08-31 15:05:57 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -42,6 +42,8 @@ static void swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc); static void horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc); static void horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc); static void horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc); +static void swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc); +static void swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc); static void fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc); static void fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc); static int PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s); @@ -207,7 +209,24 @@ PredictorSetupEncode(TIFF* tif) sp->encodetile = tif->tif_encodetile; tif->tif_encodetile = PredictorEncodeTile; } - } + + /* + * If the data is horizontally differenced 16-bit data that + * requires byte-swapping, then it must be byte swapped after + * the differenciation step. We do this with a special-purpose + * routine and override the normal post decoding logic that + * the library setup when the directory was read. + */ + if (tif->tif_flags & TIFF_SWAB) { + if (sp->encodepfunc == horDiff16) { + sp->encodepfunc = swabHorDiff16; + tif->tif_postdecode = _TIFFNoPostDecode; + } else if (sp->encodepfunc == horDiff32) { + sp->encodepfunc = swabHorDiff32; + tif->tif_postdecode = _TIFFNoPostDecode; + } + } + } else if (sp->predictor == 3) { sp->encodepfunc = fpDiff; @@ -239,12 +258,18 @@ PredictorSetupEncode(TIFF* tif) case 0: ; \ } +/* Remarks related to C standard compliance in all below functions : */ +/* - to avoid any undefined behaviour, we only operate on unsigned types */ +/* since the behaviour of "overflows" is defined (wrap over) */ +/* - when storing into the byte stream, we explicitly mask with 0xff so */ +/* as to make icc -check=conversions happy (not necessary by the standard) */ + static void horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc) { tmsize_t stride = PredictorState(tif)->stride; - char* cp = (char*) cp0; + unsigned char* cp = (unsigned char*) cp0; assert((cc%stride)==0); if (cc > stride) { /* @@ -257,9 +282,9 @@ horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc) cc -= 3; cp += 3; while (cc>0) { - cp[0] = (char) (cr += cp[0]); - cp[1] = (char) (cg += cp[1]); - cp[2] = (char) (cb += cp[2]); + cp[0] = (unsigned char) ((cr += cp[0]) & 0xff); + cp[1] = (unsigned char) ((cg += cp[1]) & 0xff); + cp[2] = (unsigned char) ((cb += cp[2]) & 0xff); cc -= 3; cp += 3; } @@ -271,10 +296,10 @@ horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc) cc -= 4; cp += 4; while (cc>0) { - cp[0] = (char) (cr += cp[0]); - cp[1] = (char) (cg += cp[1]); - cp[2] = (char) (cb += cp[2]); - cp[3] = (char) (ca += cp[3]); + cp[0] = (unsigned char) ((cr += cp[0]) & 0xff); + cp[1] = (unsigned char) ((cg += cp[1]) & 0xff); + cp[2] = (unsigned char) ((cb += cp[2]) & 0xff); + cp[3] = (unsigned char) ((ca += cp[3]) & 0xff); cc -= 4; cp += 4; } @@ -282,7 +307,7 @@ horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc) cc -= stride; do { REPEAT4(stride, cp[stride] = - (char) (cp[stride] + *cp); cp++) + (unsigned char) ((cp[stride] + *cp) & 0xff); cp++) cc -= stride; } while (cc>0); } @@ -292,20 +317,11 @@ horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc) static void swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc) { - tmsize_t stride = PredictorState(tif)->stride; uint16* wp = (uint16*) cp0; tmsize_t wc = cc / 2; - assert((cc%(2*stride))==0); - - if (wc > stride) { - TIFFSwabArrayOfShort(wp, wc); - wc -= stride; - do { - REPEAT4(stride, wp[stride] += wp[0]; wp++) - wc -= stride; - } while (wc > 0); - } + TIFFSwabArrayOfShort(wp, wc); + horAcc16(tif, cp0, cc); } static void @@ -320,7 +336,7 @@ horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc) if (wc > stride) { wc -= stride; do { - REPEAT4(stride, wp[stride] += wp[0]; wp++) + REPEAT4(stride, wp[stride] = (uint16)(((unsigned int)wp[stride] + (unsigned int)wp[0]) & 0xffff); wp++) wc -= stride; } while (wc > 0); } @@ -329,20 +345,11 @@ horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc) static void swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc) { - tmsize_t stride = PredictorState(tif)->stride; uint32* wp = (uint32*) cp0; tmsize_t wc = cc / 4; - assert((cc%(4*stride))==0); - - if (wc > stride) { - TIFFSwabArrayOfLong(wp, wc); - wc -= stride; - do { - REPEAT4(stride, wp[stride] += wp[0]; wp++) - wc -= stride; - } while (wc > 0); - } + TIFFSwabArrayOfLong(wp, wc); + horAcc32(tif, cp0, cc); } static void @@ -382,7 +389,8 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc) return; while (count > stride) { - REPEAT4(stride, cp[stride] += cp[0]; cp++) + REPEAT4(stride, cp[stride] = + (unsigned char) ((cp[stride] + cp[0]) & 0xff); cp++) count -= stride; } @@ -456,7 +464,7 @@ horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tmsize_t stride = sp->stride; - char* cp = (char*) cp0; + unsigned char* cp = (unsigned char*) cp0; assert((cc%stride)==0); @@ -466,33 +474,33 @@ horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc) * Pipeline the most common cases. */ if (stride == 3) { - int r1, g1, b1; - int r2 = cp[0]; - int g2 = cp[1]; - int b2 = cp[2]; + unsigned int r1, g1, b1; + unsigned int r2 = cp[0]; + unsigned int g2 = cp[1]; + unsigned int b2 = cp[2]; do { - r1 = cp[3]; cp[3] = r1-r2; r2 = r1; - g1 = cp[4]; cp[4] = g1-g2; g2 = g1; - b1 = cp[5]; cp[5] = b1-b2; b2 = b1; + r1 = cp[3]; cp[3] = (unsigned char)((r1-r2)&0xff); r2 = r1; + g1 = cp[4]; cp[4] = (unsigned char)((g1-g2)&0xff); g2 = g1; + b1 = cp[5]; cp[5] = (unsigned char)((b1-b2)&0xff); b2 = b1; cp += 3; } while ((cc -= 3) > 0); } else if (stride == 4) { - int r1, g1, b1, a1; - int r2 = cp[0]; - int g2 = cp[1]; - int b2 = cp[2]; - int a2 = cp[3]; + unsigned int r1, g1, b1, a1; + unsigned int r2 = cp[0]; + unsigned int g2 = cp[1]; + unsigned int b2 = cp[2]; + unsigned int a2 = cp[3]; do { - r1 = cp[4]; cp[4] = r1-r2; r2 = r1; - g1 = cp[5]; cp[5] = g1-g2; g2 = g1; - b1 = cp[6]; cp[6] = b1-b2; b2 = b1; - a1 = cp[7]; cp[7] = a1-a2; a2 = a1; + r1 = cp[4]; cp[4] = (unsigned char)((r1-r2)&0xff); r2 = r1; + g1 = cp[5]; cp[5] = (unsigned char)((g1-g2)&0xff); g2 = g1; + b1 = cp[6]; cp[6] = (unsigned char)((b1-b2)&0xff); b2 = b1; + a1 = cp[7]; cp[7] = (unsigned char)((a1-a2)&0xff); a2 = a1; cp += 4; } while ((cc -= 4) > 0); } else { cp += cc - 1; do { - REPEAT4(stride, cp[stride] -= cp[0]; cp--) + REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--) } while ((cc -= stride) > 0); } } @@ -503,7 +511,7 @@ horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tmsize_t stride = sp->stride; - int16 *wp = (int16*) cp0; + uint16 *wp = (uint16*) cp0; tmsize_t wc = cc/2; assert((cc%(2*stride))==0); @@ -512,18 +520,29 @@ horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc) wc -= stride; wp += wc - 1; do { - REPEAT4(stride, wp[stride] -= wp[0]; wp--) + REPEAT4(stride, wp[stride] = (uint16)(((unsigned int)wp[stride] - (unsigned int)wp[0]) & 0xffff); wp--) wc -= stride; } while (wc > 0); } } static void +swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc) +{ + uint16* wp = (uint16*) cp0; + tmsize_t wc = cc / 2; + + horDiff16(tif, cp0, cc); + + TIFFSwabArrayOfShort(wp, wc); +} + +static void horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tmsize_t stride = sp->stride; - int32 *wp = (int32*) cp0; + uint32 *wp = (uint32*) cp0; tmsize_t wc = cc/4; assert((cc%(4*stride))==0); @@ -538,6 +557,17 @@ horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc) } } +static void +swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc) +{ + uint32* wp = (uint32*) cp0; + tmsize_t wc = cc / 4; + + horDiff32(tif, cp0, cc); + + TIFFSwabArrayOfLong(wp, wc); +} + /* * Floating point predictor differencing routine. */ @@ -573,7 +603,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc) cp = (uint8 *) cp0; cp += cc - stride - 1; for (count = cc; count > stride; count -= stride) - REPEAT4(stride, cp[stride] -= cp[0]; cp--) + REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--) } static int diff --git a/src/3rdparty/libtiff/libtiff/tif_print.c b/src/3rdparty/libtiff/libtiff/tif_print.c index 402666d..7b1a422 100644 --- a/src/3rdparty/libtiff/libtiff/tif_print.c +++ b/src/3rdparty/libtiff/libtiff/tif_print.c @@ -1,4 +1,4 @@ -/* $Id: tif_print.c,v 1.60 2012-08-19 16:56:35 bfriesen Exp $ */ +/* $Id: tif_print.c,v 1.62 2015-08-19 02:31:04 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -35,7 +35,7 @@ #include <ctype.h> static void -_TIFFprintAsciiBounded(FILE* fd, const char* cp, int max_chars); +_TIFFprintAsciiBounded(FILE* fd, const char* cp, size_t max_chars); static const char *photoNames[] = { "min-is-white", /* PHOTOMETRIC_MINISWHITE */ @@ -395,7 +395,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) for (cp = td->td_inknames; i > 0 && cp < td->td_inknames + td->td_inknameslen; cp = strchr(cp,'\0')+1, i--) { - int max_chars = + size_t max_chars = td->td_inknameslen - (cp - td->td_inknames); fputs(sep, fd); _TIFFprintAsciiBounded(fd, cp, max_chars); @@ -582,10 +582,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) continue; if(fip->field_passcount) { - if (fip->field_readcount == TIFF_VARIABLE ) { + if (fip->field_readcount == TIFF_VARIABLE2 ) { if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1) continue; - } else if (fip->field_readcount == TIFF_VARIABLE2 ) { + } else if (fip->field_readcount == TIFF_VARIABLE ) { uint16 small_value_count; if(TIFFGetField(tif, tag, &small_value_count, &raw_data) != 1) continue; @@ -679,7 +679,7 @@ _TIFFprintAscii(FILE* fd, const char* cp) } static void -_TIFFprintAsciiBounded(FILE* fd, const char* cp, int max_chars) +_TIFFprintAsciiBounded(FILE* fd, const char* cp, size_t max_chars) { for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--) { const char* tp; diff --git a/src/3rdparty/libtiff/libtiff/tif_read.c b/src/3rdparty/libtiff/libtiff/tif_read.c index fe36e68..5cb419b 100644 --- a/src/3rdparty/libtiff/libtiff/tif_read.c +++ b/src/3rdparty/libtiff/libtiff/tif_read.c @@ -1,4 +1,4 @@ -/* $Id: tif_read.c,v 1.41 2012-07-06 19:22:58 bfriesen Exp $ */ +/* $Id: tif_read.c,v 1.45 2015-06-07 22:35:40 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -47,7 +47,7 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart ) { static const char module[] = "TIFFFillStripPartial"; register TIFFDirectory *td = &tif->tif_dir; - uint64 unused_data; + tmsize_t unused_data; uint64 read_offset; tmsize_t cc, to_read; /* tmsize_t bytecountm; */ @@ -117,7 +117,7 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart ) if( (uint64) to_read > td->td_stripbytecount[strip] - tif->tif_rawdataoff - tif->tif_rawdataloaded ) { - to_read = td->td_stripbytecount[strip] + to_read = (tmsize_t) td->td_stripbytecount[strip] - tif->tif_rawdataoff - tif->tif_rawdataloaded; } @@ -458,7 +458,7 @@ TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) return ((tmsize_t)(-1)); } bytecount = td->td_stripbytecount[strip]; - if (bytecount <= 0) { + if ((int64)bytecount <= 0) { #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, "%I64u: Invalid strip byte count, strip %lu", @@ -498,7 +498,7 @@ TIFFFillStrip(TIFF* tif, uint32 strip) if ((tif->tif_flags&TIFF_NOREADRAW)==0) { uint64 bytecount = td->td_stripbytecount[strip]; - if (bytecount <= 0) { + if ((int64)bytecount <= 0) { #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, "Invalid strip byte count %I64u, strip %lu", @@ -801,7 +801,7 @@ TIFFFillTile(TIFF* tif, uint32 tile) if ((tif->tif_flags&TIFF_NOREADRAW)==0) { uint64 bytecount = td->td_stripbytecount[tile]; - if (bytecount <= 0) { + if ((int64)bytecount <= 0) { #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, "%I64u: Invalid tile byte count, tile %lu", @@ -930,8 +930,11 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size) tif->tif_flags &= ~TIFF_MYBUFFER; } else { tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64((uint64)size, 1024); - if (tif->tif_rawdatasize==0) - tif->tif_rawdatasize=(tmsize_t)(-1); + if (tif->tif_rawdatasize==0) { + TIFFErrorExt(tif->tif_clientdata, module, + "Invalid buffer size"); + return (0); + } tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize); tif->tif_flags |= TIFF_MYBUFFER; } @@ -987,10 +990,12 @@ TIFFStartStrip(TIFF* tif, uint32 strip) static int TIFFStartTile(TIFF* tif, uint32 tile) { + static const char module[] = "TIFFStartTile"; TIFFDirectory *td = &tif->tif_dir; + uint32 howmany32; - if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) - return 0; + if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) + return 0; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupdecode)(tif)) @@ -998,12 +1003,18 @@ TIFFStartTile(TIFF* tif, uint32 tile) tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_curtile = tile; - tif->tif_row = - (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * - td->td_tilelength; - tif->tif_col = - (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) * - td->td_tilewidth; + howmany32=TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth); + if (howmany32 == 0) { + TIFFErrorExt(tif->tif_clientdata,module,"Zero tiles"); + return 0; + } + tif->tif_row = (tile % howmany32) * td->td_tilelength; + howmany32=TIFFhowmany_32(td->td_imagelength, td->td_tilelength); + if (howmany32 == 0) { + TIFFErrorExt(tif->tif_clientdata,module,"Zero tiles"); + return 0; + } + tif->tif_col = (tile % howmany32) * td->td_tilewidth; tif->tif_flags &= ~TIFF_BUF4WRITE; if (tif->tif_flags&TIFF_NOREADRAW) { diff --git a/src/3rdparty/libtiff/libtiff/tif_stream.cxx b/src/3rdparty/libtiff/libtiff/tif_stream.cxx index 163447e..ecca1fd 100644 --- a/src/3rdparty/libtiff/libtiff/tif_stream.cxx +++ b/src/3rdparty/libtiff/libtiff/tif_stream.cxx @@ -1,4 +1,4 @@ -/* $Id: tif_stream.cxx,v 1.11 2010-12-11 23:12:29 faxguy Exp $ */ +/* $Id: tif_stream.cxx,v 1.13 2015-05-28 01:50:22 bfriesen Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -340,12 +340,16 @@ _tiffisCloseProc(thandle_t fd) static int _tiffDummyMapProc(thandle_t , void** base, toff_t* size ) { + (void) base; + (void) size; return (0); } static void _tiffDummyUnmapProc(thandle_t , void* base, toff_t size ) { + (void) base; + (void) size; } /* @@ -417,9 +421,10 @@ TIFFStreamOpen(const char* name, istream *is) /* vim: set ts=8 sts=8 sw=8 noet: */ /* - Local Variables: - mode: c - indent-tabs-mode: true - c-basic-offset: 8 - End: -*/ + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ + diff --git a/src/3rdparty/libtiff/libtiff/tif_strip.c b/src/3rdparty/libtiff/libtiff/tif_strip.c index 568e489..6cac71d 100644 --- a/src/3rdparty/libtiff/libtiff/tif_strip.c +++ b/src/3rdparty/libtiff/libtiff/tif_strip.c @@ -1,4 +1,4 @@ -/* $Id: tif_strip.c,v 1.35 2012-06-06 05:33:55 fwarmerdam Exp $ */ +/* $Id: tif_strip.c,v 1.36 2015-06-07 22:35:40 bfriesen Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -317,7 +317,14 @@ TIFFScanlineSize64(TIFF* tif) } } else + { scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,td->td_imagewidth,td->td_bitspersample,module),8); + } + if (scanline_size == 0) + { + TIFFErrorExt(tif->tif_clientdata,module,"Computed scanline size is zero"); + return 0; + } return(scanline_size); } tmsize_t @@ -328,8 +335,7 @@ TIFFScanlineSize(TIFF* tif) tmsize_t n; m=TIFFScanlineSize64(tif); n=(tmsize_t)m; - if ((uint64)n!=m) - { + if ((uint64)n!=m) { TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow"); n=0; } diff --git a/src/3rdparty/libtiff/libtiff/tif_tile.c b/src/3rdparty/libtiff/libtiff/tif_tile.c index 0ff7e85..388e168 100644 --- a/src/3rdparty/libtiff/libtiff/tif_tile.c +++ b/src/3rdparty/libtiff/libtiff/tif_tile.c @@ -1,4 +1,4 @@ -/* $Id: tif_tile.c,v 1.23 2012-06-06 05:33:55 fwarmerdam Exp $ */ +/* $Id: tif_tile.c,v 1.24 2015-06-07 22:35:40 bfriesen Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -143,17 +143,40 @@ TIFFNumberOfTiles(TIFF* tif) uint64 TIFFTileRowSize64(TIFF* tif) { + static const char module[] = "TIFFTileRowSize64"; TIFFDirectory *td = &tif->tif_dir; uint64 rowsize; + uint64 tilerowsize; - if (td->td_tilelength == 0 || td->td_tilewidth == 0) + if (td->td_tilelength == 0) + { + TIFFErrorExt(tif->tif_clientdata,module,"Tile length is zero"); + return 0; + } + if (td->td_tilewidth == 0) + { + TIFFErrorExt(tif->tif_clientdata,module,"Tile width is zero"); return (0); + } rowsize = _TIFFMultiply64(tif, td->td_bitspersample, td->td_tilewidth, "TIFFTileRowSize"); if (td->td_planarconfig == PLANARCONFIG_CONTIG) + { + if (td->td_samplesperpixel == 0) + { + TIFFErrorExt(tif->tif_clientdata,module,"Samples per pixel is zero"); + return 0; + } rowsize = _TIFFMultiply64(tif, rowsize, td->td_samplesperpixel, "TIFFTileRowSize"); - return (TIFFhowmany8_64(rowsize)); + } + tilerowsize=TIFFhowmany8_64(rowsize); + if (tilerowsize == 0) + { + TIFFErrorExt(tif->tif_clientdata,module,"Computed tile row size is zero"); + return 0; + } + return (tilerowsize); } tmsize_t TIFFTileRowSize(TIFF* tif) diff --git a/src/3rdparty/libtiff/libtiff/tif_unix.c b/src/3rdparty/libtiff/libtiff/tif_unix.c index 1387558..81e9d66 100644 --- a/src/3rdparty/libtiff/libtiff/tif_unix.c +++ b/src/3rdparty/libtiff/libtiff/tif_unix.c @@ -1,4 +1,4 @@ -/* $Id: tif_unix.c,v 1.23 2012-06-01 21:40:59 fwarmerdam Exp $ */ +/* $Id: tif_unix.c,v 1.27 2015-08-19 02:31:04 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -55,53 +55,102 @@ #include "tiffiop.h" + +#define TIFF_IO_MAX 2147483647U + + +typedef union fd_as_handle_union +{ + int fd; + thandle_t h; +} fd_as_handle_union_t; + static tmsize_t _tiffReadProc(thandle_t fd, void* buf, tmsize_t size) { - size_t size_io = (size_t) size; - if ((tmsize_t) size_io != size) + fd_as_handle_union_t fdh; + const size_t bytes_total = (size_t) size; + size_t bytes_read; + tmsize_t count = -1; + if ((tmsize_t) bytes_total != size) { errno=EINVAL; return (tmsize_t) -1; } - return ((tmsize_t) read((int) fd, buf, size_io)); + fdh.h = fd; + for (bytes_read=0; bytes_read < bytes_total; bytes_read+=count) + { + char *buf_offset = (char *) buf+bytes_read; + size_t io_size = bytes_total-bytes_read; + if (io_size > TIFF_IO_MAX) + io_size = TIFF_IO_MAX; + count=read(fdh.fd, buf_offset, (TIFFIOSize_t) io_size); + if (count <= 0) + break; + } + if (count < 0) + return (tmsize_t)-1; + return (tmsize_t) bytes_read; } static tmsize_t _tiffWriteProc(thandle_t fd, void* buf, tmsize_t size) { - size_t size_io = (size_t) size; - if ((tmsize_t) size_io != size) + fd_as_handle_union_t fdh; + const size_t bytes_total = (size_t) size; + size_t bytes_written; + tmsize_t count = -1; + if ((tmsize_t) bytes_total != size) { errno=EINVAL; return (tmsize_t) -1; } - return ((tmsize_t) write((int) fd, buf, size_io)); + fdh.h = fd; + for (bytes_written=0; bytes_written < bytes_total; bytes_written+=count) + { + const char *buf_offset = (char *) buf+bytes_written; + size_t io_size = bytes_total-bytes_written; + if (io_size > TIFF_IO_MAX) + io_size = TIFF_IO_MAX; + count=write(fdh.fd, buf_offset, (TIFFIOSize_t) io_size); + if (count <= 0) + break; + } + if (count < 0) + return (tmsize_t)-1; + return (tmsize_t) bytes_written; + /* return ((tmsize_t) write(fdh.fd, buf, bytes_total)); */ } static uint64 _tiffSeekProc(thandle_t fd, uint64 off, int whence) { - off_t off_io = (off_t) off; + fd_as_handle_union_t fdh; + _TIFF_off_t off_io = (_TIFF_off_t) off; if ((uint64) off_io != off) { errno=EINVAL; return (uint64) -1; /* this is really gross */ } - return((uint64)lseek((int)fd,off_io,whence)); + fdh.h = fd; + return((uint64)_TIFF_lseek_f(fdh.fd,off_io,whence)); } static int _tiffCloseProc(thandle_t fd) { - return(close((int)fd)); + fd_as_handle_union_t fdh; + fdh.h = fd; + return(close(fdh.fd)); } static uint64 _tiffSizeProc(thandle_t fd) { - struct stat sb; - if (fstat((int)fd,&sb)<0) + _TIFF_stat_s sb; + fd_as_handle_union_t fdh; + fdh.h = fd; + if (_TIFF_fstat_f(fdh.fd,&sb)<0) return(0); else return((uint64)sb.st_size); @@ -116,8 +165,10 @@ _tiffMapProc(thandle_t fd, void** pbase, toff_t* psize) uint64 size64 = _tiffSizeProc(fd); tmsize_t sizem = (tmsize_t)size64; if ((uint64)sizem==size64) { + fd_as_handle_union_t fdh; + fdh.h = fd; *pbase = (void*) - mmap(0, (size_t)sizem, PROT_READ, MAP_SHARED, (int) fd, 0); + mmap(0, (size_t)sizem, PROT_READ, MAP_SHARED, fdh.fd, 0); if (*pbase != (void*) -1) { *psize = (tmsize_t)sizem; return (1); @@ -155,8 +206,10 @@ TIFFFdOpen(int fd, const char* name, const char* mode) { TIFF* tif; + fd_as_handle_union_t fdh; + fdh.fd = fd; tif = TIFFClientOpen(name, mode, - (thandle_t) fd, + fdh.h, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); @@ -225,7 +278,7 @@ TIFFOpenW(const wchar_t* name, const char* mode) fd = _wopen(name, m, 0666); if (fd < 0) { - TIFFErrorExt(0, module, "%s: Cannot open", name); + TIFFErrorExt(0, module, "%ls: Cannot open", name); return ((TIFF *)0); } @@ -257,6 +310,9 @@ TIFFOpenW(const wchar_t* name, const char* mode) void* _TIFFmalloc(tmsize_t s) { + if (s == 0) + return ((void *) NULL); + return (malloc((size_t) s)); } diff --git a/src/3rdparty/libtiff/libtiff/tif_win32.c b/src/3rdparty/libtiff/libtiff/tif_win32.c index 5fa828f..fdc2ee6 100644 --- a/src/3rdparty/libtiff/libtiff/tif_win32.c +++ b/src/3rdparty/libtiff/libtiff/tif_win32.c @@ -1,4 +1,4 @@ -/* $Id: tif_win32.c,v 1.39 2011-12-22 17:07:57 bfriesen Exp $ */ +/* $Id: tif_win32.c,v 1.41 2015-08-23 20:12:44 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -28,6 +28,31 @@ * TIFF Library Win32-specific Routines. Adapted from tif_unix.c 4/5/95 by * Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA */ + +/* + CreateFileA/CreateFileW return type 'HANDLE'. + + thandle_t is declared like + + DECLARE_HANDLE(thandle_t); + + in tiffio.h. + + Windows (from winnt.h) DECLARE_HANDLE logic looks like + + #ifdef STRICT + typedef void *HANDLE; + #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name + #else + typedef PVOID HANDLE; + #define DECLARE_HANDLE(name) typedef HANDLE name + #endif + + See http://bugzilla.maptools.org/show_bug.cgi?id=1941 for problems in WIN64 + builds resulting from this. Unfortunately, the proposed patch was lost. + +*/ + #include "tiffiop.h" #include <windows.h> @@ -214,7 +239,7 @@ TIFFFdOpen(int ifd, const char* name, const char* mode) break; } } - tif = TIFFClientOpen(name, mode, (thandle_t)ifd, + tif = TIFFClientOpen(name, mode, (thandle_t)ifd, /* FIXME: WIN64 cast to pointer warning */ _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, fSuppressMap ? _tiffDummyMapProc : _tiffMapProc, @@ -259,7 +284,7 @@ TIFFOpen(const char* name, const char* mode) return ((TIFF *)0); } - tif = TIFFFdOpen((int)fd, name, mode); + tif = TIFFFdOpen((int)fd, name, mode); /* FIXME: WIN64 cast from pointer to int warning */ if(!tif) CloseHandle(fd); return tif; @@ -314,7 +339,7 @@ TIFFOpenW(const wchar_t* name, const char* mode) NULL, NULL); } - tif = TIFFFdOpen((int)fd, + tif = TIFFFdOpen((int)fd, /* FIXME: WIN64 cast from pointer to int warning */ (mbname != NULL) ? mbname : "<unknown>", mode); if(!tif) CloseHandle(fd); @@ -329,6 +354,9 @@ TIFFOpenW(const wchar_t* name, const char* mode) void* _TIFFmalloc(tmsize_t s) { + if (s == 0) + return ((void *) NULL); + return (malloc((size_t) s)); } diff --git a/src/3rdparty/libtiff/libtiff/tif_write.c b/src/3rdparty/libtiff/libtiff/tif_write.c index 8792123..7996c31 100644 --- a/src/3rdparty/libtiff/libtiff/tif_write.c +++ b/src/3rdparty/libtiff/libtiff/tif_write.c @@ -1,4 +1,4 @@ -/* $Id: tif_write.c,v 1.37 2012-08-13 22:10:17 fwarmerdam Exp $ */ +/* $Id: tif_write.c,v 1.42 2015-06-07 23:00:23 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -115,6 +115,10 @@ TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample) if (strip >= td->td_stripsperimage && imagegrew) td->td_stripsperimage = TIFFhowmany_32(td->td_imagelength,td->td_rowsperstrip); + if (td->td_stripsperimage == 0) { + TIFFErrorExt(tif->tif_clientdata, module, "Zero strips per image"); + return (-1); + } tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { @@ -220,6 +224,11 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc) tif->tif_flags |= TIFF_BUF4WRITE; tif->tif_curstrip = strip; + if (td->td_stripsperimage == 0) { + TIFFErrorExt(tif->tif_clientdata, module, "Zero strips per image"); + return ((tmsize_t) -1); + } + tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupencode)(tif)) @@ -233,7 +242,7 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc) /* more bytes available in the output buffer than the previous byte count, */ /* so that TIFFAppendToStrip() will detect the overflow when it is called the first */ /* time if the new compressed tile is bigger than the older one. (GDAL #4771) */ - if( tif->tif_rawdatasize <= td->td_stripbytecount[strip] ) + if( tif->tif_rawdatasize <= (tmsize_t)td->td_stripbytecount[strip] ) { if( !(TIFFWriteBufferSetup(tif, NULL, (tmsize_t)TIFFroundup_64((uint64)(td->td_stripbytecount[strip] + 1), 1024))) ) @@ -311,6 +320,10 @@ TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc) return ((tmsize_t) -1); } tif->tif_curstrip = strip; + if (td->td_stripsperimage == 0) { + TIFFErrorExt(tif->tif_clientdata, module,"Zero strips per image"); + return ((tmsize_t) -1); + } tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; return (TIFFAppendToStrip(tif, strip, (uint8*) data, cc) ? cc : (tmsize_t) -1); @@ -353,6 +366,7 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) static const char module[] = "TIFFWriteEncodedTile"; TIFFDirectory *td; uint16 sample; + uint32 howmany32; if (!WRITECHECKTILES(tif, module)) return ((tmsize_t)(-1)); @@ -379,7 +393,7 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) /* more bytes available in the output buffer than the previous byte count, */ /* so that TIFFAppendToStrip() will detect the overflow when it is called the first */ /* time if the new compressed tile is bigger than the older one. (GDAL #4771) */ - if( tif->tif_rawdatasize <= td->td_stripbytecount[tile] ) + if( tif->tif_rawdatasize <= (tmsize_t) td->td_stripbytecount[tile] ) { if( !(TIFFWriteBufferSetup(tif, NULL, (tmsize_t)TIFFroundup_64((uint64)(td->td_stripbytecount[tile] + 1), 1024))) ) @@ -391,17 +405,25 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) tif->tif_curoff = 0; } - tif->tif_rawcc = 0; - tif->tif_rawcp = tif->tif_rawdata; + tif->tif_rawcc = 0; + tif->tif_rawcp = tif->tif_rawdata; /* * Compute tiles per row & per column to compute * current row and column */ - tif->tif_row = (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) - * td->td_tilelength; - tif->tif_col = (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) - * td->td_tilewidth; + howmany32=TIFFhowmany_32(td->td_imagelength, td->td_tilelength); + if (howmany32 == 0) { + TIFFErrorExt(tif->tif_clientdata,module,"Zero tiles"); + return ((tmsize_t)(-1)); + } + tif->tif_row = (tile % howmany32) * td->td_tilelength; + howmany32=TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth); + if (howmany32 == 0) { + TIFFErrorExt(tif->tif_clientdata,module,"Zero tiles"); + return ((tmsize_t)(-1)); + } + tif->tif_col = (tile % howmany32) * td->td_tilewidth; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupencode)(tif)) diff --git a/src/3rdparty/libtiff/libtiff/tif_zip.c b/src/3rdparty/libtiff/libtiff/tif_zip.c index f5aa2a9..22e9f35 100644 --- a/src/3rdparty/libtiff/libtiff/tif_zip.c +++ b/src/3rdparty/libtiff/libtiff/tif_zip.c @@ -1,4 +1,4 @@ -/* $Id: tif_zip.c,v 1.31 2011-01-06 16:00:23 fwarmerdam Exp $ */ +/* $Id: tif_zip.c,v 1.33 2014-12-25 18:29:11 erouault Exp $ */ /* * Copyright (c) 1995-1997 Sam Leffler @@ -36,7 +36,7 @@ * of the library: this code assumes the 1.0 API and also depends on * the ability to write the zlib header multiple times (one per strip) * which was not possible with versions prior to 0.95. Note also that - * older versions of this codec avoided this bug by supressing the header + * older versions of this codec avoided this bug by suppressing the header * entirely. This means that files written with the old library cannot * be read; they should be converted to a different compression scheme * and then reconverted. @@ -61,6 +61,8 @@ #error "Antiquated ZLIB software; you must use version 1.0 or later" #endif +#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg) + /* * State block for each open TIFF * file using ZIP compression/decompression. @@ -106,7 +108,7 @@ ZIPSetupDecode(TIFF* tif) } if (inflateInit(&sp->stream) != Z_OK) { - TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg); + TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp)); return (0); } else { sp->state |= ZSTATE_INIT_DECODE; @@ -174,14 +176,14 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) if (state == Z_DATA_ERROR) { TIFFErrorExt(tif->tif_clientdata, module, "Decoding error at scanline %lu, %s", - (unsigned long) tif->tif_row, sp->stream.msg); + (unsigned long) tif->tif_row, SAFE_MSG(sp)); if (inflateSync(&sp->stream) != Z_OK) return (0); continue; } if (state != Z_OK) { - TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s", - sp->stream.msg); + TIFFErrorExt(tif->tif_clientdata, module, + "ZLib error: %s", SAFE_MSG(sp)); return (0); } } while (sp->stream.avail_out > 0); @@ -211,7 +213,7 @@ ZIPSetupEncode(TIFF* tif) } if (deflateInit(&sp->stream, sp->zipquality) != Z_OK) { - TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg); + TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp)); return (0); } else { sp->state |= ZSTATE_INIT_ENCODE; @@ -273,8 +275,9 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) } do { if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) { - TIFFErrorExt(tif->tif_clientdata, module, "Encoder error: %s", - sp->stream.msg); + TIFFErrorExt(tif->tif_clientdata, module, + "Encoder error: %s", + SAFE_MSG(sp)); return (0); } if (sp->stream.avail_out == 0) { @@ -313,8 +316,8 @@ ZIPPostEncode(TIFF* tif) } break; default: - TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s", - sp->stream.msg); + TIFFErrorExt(tif->tif_clientdata, module, + "ZLib error: %s", SAFE_MSG(sp)); return (0); } } while (state != Z_STREAM_END); @@ -359,7 +362,7 @@ ZIPVSetField(TIFF* tif, uint32 tag, va_list ap) if (deflateParams(&sp->stream, sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s", - sp->stream.msg); + SAFE_MSG(sp)); return (0); } } diff --git a/src/3rdparty/libtiff/libtiff/tiff.h b/src/3rdparty/libtiff/libtiff/tiff.h index 19b4e79..bc46acd 100644 --- a/src/3rdparty/libtiff/libtiff/tiff.h +++ b/src/3rdparty/libtiff/libtiff/tiff.h @@ -1,4 +1,4 @@ -/* $Id: tiff.h,v 1.68 2012-08-19 16:56:35 bfriesen Exp $ */ +/* $Id: tiff.h,v 1.69 2014-04-02 17:23:06 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -201,6 +201,7 @@ typedef enum { #define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ #define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */ #define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */ +#define PHOTOMETRIC_CFA 32803 /* color filter array */ #define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */ #define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */ #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ @@ -402,6 +403,8 @@ typedef enum { #define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306 /* tag 33405 is a private tag registered to Eastman Kodak */ #define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */ +#define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* dimensions of CFA pattern */ +#define TIFFTAG_CFAPATTERN 33422 /* color filter array pattern */ /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */ #define TIFFTAG_COPYRIGHT 33432 /* copyright string */ /* IPTC TAG from RichTIFF specifications */ diff --git a/src/3rdparty/libtiff/libtiff/tiffconf.vc.h b/src/3rdparty/libtiff/libtiff/tiffconf.vc.h index 680f839..c8c6c65 100644 --- a/src/3rdparty/libtiff/libtiff/tiffconf.vc.h +++ b/src/3rdparty/libtiff/libtiff/tiffconf.vc.h @@ -55,22 +55,23 @@ /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned __int64 +#if _WIN64 +/* + Windows 64-bit build +*/ + /* Signed size type */ -#if defined(_WIN64) -#define TIFF_SSIZE_T signed __int64 -#else -#define TIFF_SSIZE_T signed int -#endif +# define TIFF_SSIZE_T TIFF_INT64_T -/* Signed size type formatter */ -#if defined(_WIN64) -#define TIFF_SSIZE_FORMAT "%I64d" #else -#define TIFF_SSIZE_FORMAT "%ld" -#endif +/* + Windows 32-bit build +*/ -/* Pointer difference type */ -#define TIFF_PTRDIFF_T long +/* Signed size type */ +# define TIFF_SSIZE_T signed int + +#endif /* Compatibility stuff. */ diff --git a/src/3rdparty/libtiff/libtiff/tiffiop.h b/src/3rdparty/libtiff/libtiff/tiffiop.h index 916c998..e5d862b 100644 --- a/src/3rdparty/libtiff/libtiff/tiffiop.h +++ b/src/3rdparty/libtiff/libtiff/tiffiop.h @@ -1,4 +1,4 @@ -/* $Id: tiffiop.h,v 1.84 2012-05-30 01:50:17 fwarmerdam Exp $ */ +/* $Id: tiffiop.h,v 1.87 2015-08-23 17:49:01 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -61,6 +61,12 @@ extern void *lfind(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); #endif +#if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF) +#undef snprintf +#define snprintf _TIFF_snprintf_f +extern int snprintf(char* str, size_t size, const char* format, ...); +#endif + #include "tiffio.h" #include "tif_dir.h" @@ -262,6 +268,53 @@ struct tiff { #define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0])) +/* + Support for large files. + + Windows read/write APIs support only 'unsigned int' rather than 'size_t'. + Windows off_t is only 32-bit, even in 64-bit builds. +*/ +#if defined(HAVE_FSEEKO) +/* + Use fseeko() and ftello() if they are available since they use + 'off_t' rather than 'long'. It is wrong to use fseeko() and + ftello() only on systems with special LFS support since some systems + (e.g. FreeBSD) support a 64-bit off_t by default. + + For MinGW, __MSVCRT_VERSION__ must be at least 0x800 to expose these + interfaces. The MinGW compiler must support the requested version. MinGW + does not distribute the CRT (it is supplied by Microsoft) so the correct CRT + must be available on the target computer in order for the program to run. +*/ +#if defined(HAVE_FSEEKO) +# define fseek(stream,offset,whence) fseeko(stream,offset,whence) +# define ftell(stream,offset,whence) ftello(stream,offset,whence) +#endif +#endif +#if defined(__WIN32__) && \ + !(defined(_MSC_VER) && _MSC_VER < 1400) && \ + !(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800) +typedef unsigned int TIFFIOSize_t; +#define _TIFF_lseek_f(fildes,offset,whence) _lseeki64(fildes,/* __int64 */ offset,whence) +/* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */ +#define _TIFF_fseek_f(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence) +#define _TIFF_fstat_f(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff) +/* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */ +/* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/ stat_buff) */ +#define _TIFF_stat_s struct _stati64 +#define _TIFF_off_t __int64 +#else +typedef size_t TIFFIOSize_t; +#define _TIFF_lseek_f(fildes,offset,whence) lseek(fildes,offset,whence) +/* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */ +#define _TIFF_fseek_f(stream,offset,whence) fseek(stream,offset,whence) +#define _TIFF_fstat_f(fildes,stat_buff) fstat(fildes,stat_buff) +/* #define _TIFF_ftell_f(stream) ftell(stream) */ +/* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */ +#define _TIFF_stat_s struct stat +#define _TIFF_off_t off_t +#endif + #if defined(__cplusplus) extern "C" { #endif diff --git a/src/3rdparty/libtiff/libtiff/tiffvers.h b/src/3rdparty/libtiff/libtiff/tiffvers.h index 40edc81..e965814 100644 --- a/src/3rdparty/libtiff/libtiff/tiffvers.h +++ b/src/3rdparty/libtiff/libtiff/tiffvers.h @@ -1,4 +1,4 @@ -#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.3\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." +#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.6\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." /* * This define can be used in code that requires * compilation-related definitions specific to a @@ -6,4 +6,4 @@ * version checking should be done based on the * string returned by TIFFGetVersion. */ -#define TIFFLIB_VERSION 20120922 +#define TIFFLIB_VERSION 20150912 diff --git a/src/3rdparty/libtiff/port/libport.h b/src/3rdparty/libtiff/port/libport.h index 802f478..d9b0421 100644 --- a/src/3rdparty/libtiff/port/libport.h +++ b/src/3rdparty/libtiff/port/libport.h @@ -1,4 +1,4 @@ -/* $Id: libport.h,v 1.2 2009-11-02 14:44:13 bfriesen Exp $ */ +/* $Id: libport.h,v 1.5 2015-08-19 02:31:04 bfriesen Exp $ */ /* * Copyright (c) 2009 Frank Warmerdam @@ -48,4 +48,13 @@ lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *)); #endif +#if !defined(HAVE_SNPRINTF) +#undef vsnprintf +#define vsnprintf _TIFF_vsnprintf_f + +#undef snprintf +#define snprintf _TIFF_snprintf_f +int snprintf(char* str, size_t size, const char* format, ...); +#endif + #endif /* ndef _LIBPORT_ */ diff --git a/src/3rdparty/libtiff/port/snprintf.c b/src/3rdparty/libtiff/port/snprintf.c new file mode 100644 index 0000000..1c4ac08 --- /dev/null +++ b/src/3rdparty/libtiff/port/snprintf.c @@ -0,0 +1,38 @@ +/** + * Workaround for lack of snprintf(3) in Visual Studio. See + * http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010/8712996#8712996 + * It's a trivial wrapper around the builtin _vsnprintf_s and + * _vscprintf functions. + */ + +#ifdef _MSC_VER + +#include <stdio.h> +#include <stdarg.h> +#include "libport.h" + +int _TIFF_vsnprintf_f(char* str, size_t size, const char* format, va_list ap) +{ + int count = -1; + + if (size != 0) + count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); + if (count == -1) + count = _vscprintf(format, ap); + + return count; +} + +int _TIFF_snprintf_f(char* str, size_t size, const char* format, ...) +{ + int count; + va_list ap; + + va_start(ap, format); + count = vsnprintf(str, size, format, ap); + va_end(ap); + + return count; +} + +#endif // _MSC_VER diff --git a/src/3rdparty/libtiff/port/strcasecmp.c b/src/3rdparty/libtiff/port/strcasecmp.c index 1ff4312..de7e423 100644 --- a/src/3rdparty/libtiff/port/strcasecmp.c +++ b/src/3rdparty/libtiff/port/strcasecmp.c @@ -1,4 +1,4 @@ -/* $Id: strcasecmp.c,v 1.3 2009-01-22 20:53:07 fwarmerdam Exp $ */ +/* $Id: strcasecmp.c,v 1.4 2015-06-21 01:09:09 bfriesen Exp $ */ /* * Copyright (c) 1987, 1993 @@ -44,8 +44,8 @@ strcasecmp(const char *s1, const char *s2) const unsigned char *us1 = (const unsigned char *)s1, *us2 = (const unsigned char *)s2; - while (tolower(*us1) == tolower(*us2++)) + while (tolower((int) *us1) == tolower((int) *us2++)) if (*us1++ == '\0') return (0); - return (tolower(*us1) - tolower(*--us2)); + return (tolower((int) *us1) - tolower((int) *--us2)); } |