Commit Graph

2754 Commits

Author SHA1 Message Date
Even Rouault
42bfc7006a * libtiff/tif_lzw.c: make nextdata a unsigned type to avoid
undefined behaviour with shifts (gcc -fsanitize=shift)
2015-08-30 21:07:44 +00:00
Even Rouault
6dc8110cee * 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 20:49:55 +00:00
Bob Friesenhahn
27e622bff5 * configure.ac: libtiff 4.0.5 released. 2015-08-30 17:37:46 +00:00
Bob Friesenhahn
7663ccc1ec Fix compiler warning about constant value promotion to unsigned long. 2015-08-29 20:39:17 +00:00
Bob Friesenhahn
bcf0cb43f4 Add ld-version-script option to cmake build. 2015-08-29 15:30:28 +00:00
Bob Friesenhahn
036132130d Add CMake build instructions. 2015-08-29 15:30:11 +00:00
Bob Friesenhahn
0d55e7db1b Remove strange termination characters from ChangeLog. 2015-08-28 22:34:15 +00:00
Bob Friesenhahn
0841549b8a Use consistent line terminations. 2015-08-28 22:19:26 +00:00
Bob Friesenhahn
c38c973b79 Added HTML file describing the changes which will appear in the 4.0.5 release. 2015-08-28 16:04:56 +00:00
Bob Friesenhahn
b1f904c7a2 Add some comments in tif_win32.c regarding known issue with WIN64 build. 2015-08-23 20:12:44 +00:00
Bob Friesenhahn
5a17dc99ce For MinGW builds, make sure required CRT is available in order to enable large file support. 2015-08-23 17:49:01 +00:00
Bob Friesenhahn
d9bc8472e7 fax2tiff eliminate warning about cast to thandle_t. 2015-08-23 15:40:45 +00:00
Bob Friesenhahn
7ea1078bea rewrite_tag test uses main() with no argument list. 2015-08-23 14:23:00 +00:00
Bob Friesenhahn
c65c70205c Fix Cmake build issues caused by Windows large file updates. 2015-08-21 01:59:33 +00:00
Bob Friesenhahn
8ba4a1c894 Support large files under Windows using tif_unix.c and libtiff tools. 2015-08-19 02:31:04 +00:00
Bob Friesenhahn
a0e1185771 Fix problem with 'boolean' definition from IJG JPEG 9. 2015-08-16 20:08:21 +00:00
Bob Friesenhahn
4199a92ce7 tif_jpeg.c consistency fixes. 2015-08-15 20:13:07 +00:00
Bob Friesenhahn
01aa45a312 CMakeLists.txt fix for libtiffxx symbol versioning. 2015-08-14 02:26:37 +00:00
Bob Friesenhahn
80dc16cf74 * 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-07-04 22:09:27 +00:00
Bob Friesenhahn
d7db70c929 Add missing file from CMake patch set. 2015-06-25 13:24:52 +00:00
Bob Friesenhahn
5b90af247e * 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-25 02:27:58 +00:00
Bob Friesenhahn
0319952da2 * test/Makefile.am: tiff2rgba-quad-tile.jpg.sh depends on the JPEG
library so only execute if JPEG is available.
2015-06-21 19:32:32 +00:00
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