Commit Graph

2932 Commits

Author SHA1 Message Date
Bob Friesenhahn
f5047249d2 * libtiff 4.0.4 released. 2015-06-21 19:13:03 +00:00
Bob Friesenhahn
bdd91bbdf8 * 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.
2015-06-21 18:46:29 +00:00
Bob Friesenhahn
37c8b068e1 * html/build.html: Try to improve the nmake-based VC++ build
description.
2015-06-21 18:21:28 +00:00
Bob Friesenhahn
47d8b0eafd * libtiff/tiffconf.vc.h: Build fixes based on testing.
* libtiff/tif_config.vc.h: Build fixes based on testing.
2015-06-21 17:02:12 +00:00
Bob Friesenhahn
848ff19ce2 * libtiff/libtiff.def: TIFFRasterScanline does not exist so remove
export for it.
2015-06-21 14:35:07 +00:00
Bob Friesenhahn
d21d2b3057 * libtiff/tif_config.vc.h: Make adjustments to match the new
definitions that configure produces, including for WIN64.  Still
needs to be tested.

'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.
2015-06-21 01:09:09 +00:00
Bob Friesenhahn
108fe0c660 * 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.
2015-06-20 20:33:17 +00:00
Bob Friesenhahn
b72cc590ae * test/raw_decode.c (XMD_H): Avoid conflicting typedefs for INT32
and boolean in MinGW build due to including jpeglib.h.
2015-06-20 16:52:25 +00:00
Bob Friesenhahn
64a6901448 * test/rewrite_tag.c (main): Fix problem with location of variable
declaration.
2015-06-20 16:33:40 +00:00
Bob Friesenhahn
d4470e0648 * 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-20 16:07:00 +00:00
Bob Friesenhahn
d233f2b83c Add v4.0.4 changes summary in preparation for release. 2015-06-18 03:08:06 +00:00
Bob Friesenhahn
0b7487c60d * libtiff/tif_getimage.c: Fix four Coverity issues related to
unintended sign extension.
2015-06-17 03:12:20 +00:00
Bob Friesenhahn
ac3107ef45 Hopefully fix four Coverity issues related to unintended sign extension. 2015-06-17 01:34:07 +00:00
Even Rouault
39113ade50 * libtiff/tif_unix.c: fix compilation with MSVC (fix by Jeff McKenna) 2015-06-16 15:33:17 +00:00
Lee Howard
a2b4dfc83a Attempt to fix Coverity warning:
CID 1306634:  Integer handling issues  (SIGN_EXTENSION)
    Suspicious implicit sign extension: "img->samplesperpixel" with type
    "unsigned short" (16 bits, unsigned) is promoted in
    "img->col_offset * img->samplesperpixel" to type "int" (32 bits, signed),
    then sign-extended to type "long" (64 bits, signed).  If
    "img->col_offset * img->samplesperpixel" is greater than 0x7FFFFFFF, the
    upper bits of the result will all be 1.
2015-06-15 16:13:46 +00:00
Lee Howard
74d1dfd161 From Vadim Zeitlin on Bugzilla Bug #2510.
The attached patch fixes several harmless but still annoying warnings when
building libtiff...
2015-06-14 23:13:40 +00:00
Lee Howard
b5587ac2e4 From Ludolf Holzheid on Bugzilla Bug #2498:
Attached is a patch that adds a configure option to select the file I/O style
on Windows hosts.

It defaults to --enable-win32-io on all windows targets other than Cygwin and
to --disable-win32-io on Cygwin, and thus should be backwards-compatible.

This allows programs using the Unix file I/O style (such as Netpbm's tifftopnm)
to link against libtiff if configured for e.g. MinGW.
2015-06-14 22:55:16 +00:00
Lee Howard
837fbcd07a Update. 2015-06-14 22:16:37 +00:00
Lee Howard
0899543308 Bugzilla Bug #2409: Contribution by Gary Cramblitt and fix confirmed by Charles Stewart
TIFFRGBAImageGet does not properly handle a non-zero col_offset in the
TIFFRGBAImage structure passed as the first argument.  The current (incorrect)
behaviour depends upon the organization of the input tiff file as follows:

1.  If the TIFF is stripped, col_offset is completely ignored.
2.  If the TIFF is tiled, the image result is shifted to the left to the
nearest tile boundary.  For example, if the tilewidth is 100, col_offset is
125, and requested width is 200, you get an image with pixels from 100 up to
300, not 125 up to 325 as expected.

This problem was reported in the mailing list previously as follows, but no
action was taken:

1.  http://www.asmail.be/msg0054834339.html although Andrew is wrong about
tiled images working fine.
2.  http://www.asmail.be/msg0054682793.html
2015-06-14 22:14:10 +00:00
Lee Howard
a411152d3f From Marcos H. Woehrmann on Bugzilla Bug #2405. This corrects the shell equality operator. 2015-06-14 21:51:17 +00:00
Lee Howard
76939f073f From Jay Berkenbilt on Bug 2401.
An Ubuntu user noticed that tiffgt was not appropriately calling glFlush(),
which was causing tiffgt to open blank windows in some cases.  I'm not sure
what the cases are, but my system happened to be one that saw blank windows,
and the one-line fix the user provided was sufficient to solve it in my case.
2015-06-14 21:44:17 +00:00
Lee Howard
106157e7d7 change ColorTransform from "0" to "1" following Bugzilla Bug #2150. 2015-06-14 20:54:32 +00:00
Lee Howard
fb9cddb6a9 Update for yesterday's commits. 2015-06-14 20:13:39 +00:00
Lee Howard
b8335269b6 From Eduardo Robles Elvira:
1. libtiffcrop-fix.patch fixes a small problem in tiffcrop, it seems it
was incorrectly using TIFFSetField instead of CopyField.

And in libtiff-correct-fax-scaling.patch we have some other changes:

2. I had to remove a check in main() that didn't allow maxPageWidth to
be bigger than pageWidth.

3. [ Omitted due to question on universality ]

4. the pagewidth variable was being set as the maxpagewidth instead,
which made all the calculations bad. This made sense when the check in
point 2 was in place, but not anymore. I've modified it so that
pagewidth is set with the specified pagewidth when maxpagewidth is
bigger.

5. The remaining lines of the patch  - in exportMaskedImage() -
basically fix the scaling.
2015-06-13 05:49:18 +00:00
Lee Howard
b6346f6672 From Antti S. Lankila on:
http://bugzilla.maptools.org/show_bug.cgi?id=2078#c9

The problem is that TIFF library attempts to write TIFF header as soon as the
tiff2pdf utility initializes the library. Fortunately, the library contains an
I/O abstraction feature, so there are no hardcoded writes to a file descriptor
anywhere. In particular, it appears that the utility's output suppression
feature can be used to suppress the initial write of the header.
2015-06-13 05:32:13 +00:00
Lee Howard
a3f0d4471b From Yuriy M. Kaminskiy:
There are a lot of code like this:

	buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
	written += t2pWriteFile(output, (tdata_t) buffer, buflen );

in tiff2pdf. This is seriously broken: when formatted string is larger than
buffer, snprintf return value is >= sizeof(buffer) [current standard] or -1
[legacy]. And in case of other errors, snprintf returns -1.
Both would result in reading unallocated memory and possible SIGSEGV (DoS).

I doubt it can be really exploitable (to begin with, in most cases buffer was
large enough and sprintf->snprintf change was pure paranoia, IMO), but /if/ you
decided previous code was not safe and snprintf is necessary, /then/ you MUST
check its return value.
2015-06-13 05:14:57 +00:00
Lee Howard
93f7131c8b Contribution from Andy Cave:
There is a longstanding bug in the LZW decompressor in LibTIFF. It
fails to decode files that contain two consecutive CODE_CLEAR codes.
These are allowed by the LZW spec and the same data sequence is
correctly decoded by Acrobat if you wrap the data in a PDF file.
2015-06-13 05:03:50 +00:00
Bob Friesenhahn
574447a0b0 * 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-10 13:17:41 +00:00
Even Rouault
2d9ec3ee8d * libtiff/tif_jpeg.c: Fix compilation in BITS_IN_JSAMPLE == 12
case
2015-06-08 08:44:37 +00:00
Bob Friesenhahn
d5d24e7065 (TIFFWriteScanline): Fix Coverity 715979 "Division or modulo by
zero".
2015-06-07 23:00:23 +00:00
Bob Friesenhahn
b989c28d1c (TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo by
zero".
2015-06-07 22:53:17 +00:00
Bob Friesenhahn
d480e894ef (TIFFWriteEncodedTile): Fix Coverity 715976 and 715977 "Division
or modulo by zero".
2015-06-07 22:47:29 +00:00
Bob Friesenhahn
30f96cda9a * libtiff/tif_write.c (TIFFWriteEncodedStrip): Fix Coverity 715975
* libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973 and
715974 "Division or modulo by zero".
2015-06-07 22:41:07 +00:00
Bob Friesenhahn
f39fc2362e * libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973
"Division or modulo by zero".
2015-06-07 22:35:40 +00:00
Bob Friesenhahn
9904e70d72 * libtiff/tif_dir.c (TIFFNumberOfDirectories): Quiet Coverity
1134470 "Logically dead code" by making the roll-over check
explicit.
2015-05-31 23:11:43 +00:00
Bob Friesenhahn
7d7b3db270 (LogLuvEncodeTile): Fix Coverity 991241 "Division or modulo by
zero".
2015-05-31 21:24:44 +00:00
Bob Friesenhahn
a1beead1ef (LogLuvEncodeStrip): Fix Coverity 991240 "Division or modulo by
zero".
2015-05-31 21:23:23 +00:00
Bob Friesenhahn
2b5c49d191 (LogLuvDecodeStrip): Fix Coverity 991239 "Division or modulo by
zero".
2015-05-31 21:21:22 +00:00
Bob Friesenhahn
e69b354c3e * libtiff/tif_luv.c (LogLuvDecodeTile): Fix Coverity 991227
"Division or modulo by zero".
2015-05-31 21:19:07 +00:00
Bob Friesenhahn
cf2cbabef1 (TIFFReadDirEntrySlong8Array): Fix Coverity 298629 "Logically dead
code"
2015-05-31 21:09:33 +00:00
Bob Friesenhahn
6132637692 (TIFFReadDirEntryFloatArray): Fix Coverity 298627 "Logically dead
code".
(TIFFReadDirEntryIfd8Array): Fix Coverity 298628 "Logically dead
code".
2015-05-31 21:07:41 +00:00
Bob Friesenhahn
b3332a8f25 (TIFFReadDirEntryFloatArray): Fix 298627 "Logically dead code". 2015-05-31 21:05:22 +00:00
Bob Friesenhahn
0f01705a85 * libtiff/tif_dirread.c (TIFFReadDirEntryDoubleArray): Fix
Coverity 298626 "Logically dead code".
2015-05-31 21:01:37 +00:00
Bob Friesenhahn
ffe4f83100 * libtiff/tif_dir.c (TIFFNumberOfDirectories): Don't depend on ++
operator precedenc in evaluation.  Might quench Coverity 1134470
"Logically dead code".
2015-05-31 20:57:56 +00:00
Bob Friesenhahn
666ca03c65 * 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-31 15:44:40 +00:00
Bob Friesenhahn
2223910e23 * libtiff/tif_dirwrite.c (_TIFFRewriteField): Fix Coverity 1024310
"Resource leak".

* libtiff/tif_ojpeg.c (OJPEGReadHeaderInfoSecStreamDht): Fix
Coverity 601720 "Resource leak".
2015-05-31 00:38:46 +00:00
Bob Friesenhahn
86f9adb7fd * libtiff/tif_jpeg.c (JPEGCleanup): Fix Coverity 298624
"Dereference before null check".
2015-05-30 23:52:24 +00:00
Bob Friesenhahn
d875609a32 * libtiff/tif_ojpeg.c (OJPEGReadBufferFill): Fix Coverity 603400
"Missing break in switch".
2015-05-30 23:49:28 +00:00
Bob Friesenhahn
9626bb6db9 * contrib/addtiffo/tif_overview.c (TIFF_DownSample): Check buffer
size calculation for overflow.
2015-05-30 21:13:39 +00:00
Bob Friesenhahn
2b221734c6 * contrib/addtiffo/addtiffo.c (main): Possibly address Coverity
1024226 "Untrusted value as argument".
2015-05-30 20:30:27 +00:00