Commit Graph

65 Commits

Author SHA1 Message Date
Norman Barker
9eacd59fec webp in tiff 2018-10-05 11:21:17 -05:00
Stefan Weil
642b8f998e Fix some typos
Most of them were found by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-02-24 21:47:52 +01:00
Even Rouault
62b9df5d2a Add ZSTD compression codec
From https://github.com/facebook/zstd
"Zstandard, or zstd as short version, is a fast lossless compression
algorithm, targeting real-time compression scenarios at zlib-level
and better compression ratios. It's backed by a very fast entropy stage,
provided by Huff0 and FSE library."

We require libzstd >= 1.0.0 so as to be able to use streaming compression
and decompression methods.

The default compression level we have selected is 9 (range goes from 1 to 22),
which experimentally offers equivalent or better compression ratio than
the default deflate/ZIP level of 6, and much faster compression.

For example on a 6600x4400 16bit image, tiffcp -c zip runs in 10.7 seconds,
while tiffcp -c zstd runs in 5.3 seconds. Decompression time for zip is
840 ms, and for zstd 650 ms. File size is 42735936 for zip, and
42586822 for zstd. Similar findings on other images.

On a 25894x16701 16bit image,

                Compression time     Decompression time     File size

ZSTD                 35 s                   3.2 s          399 700 498
ZIP/Deflate       1m 20 s                   4.9 s          419 622 336
2017-12-21 13:32:02 +01:00
Even Rouault
f0a54a4fa0 Remove all $Id and $Headers comments with CVS versions 2017-11-30 18:02:46 +01:00
Even Rouault
480167a350 * tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow and
cpSeparate2ContigByRow if BitsPerSample != 8 to avoid heap based overflow.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2656 and
http://bugzilla.maptools.org/show_bug.cgi?id=2657
2017-01-11 19:25:44 +00:00
Even Rouault
2766c8583d * tools/tiffcp.c: replace assert( (bps % 8) == 0 ) by a non assert check.
Reported by Agostino Sarubbo.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2605
2016-12-03 16:50:02 +00:00
Even Rouault
bae8284136 * tools/tiffcp.c: fix uint32 underflow/overflow that can cause heap-based
buffer overflow.
Reported by Agostino Sarubbo.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2610
2016-12-03 16:40:01 +00:00
Even Rouault
b1e5ae5984 * tools/tiffcp.c: avoid potential division by zero is BitsPerSamples tag is
missing.
Reported by Agostino Sarubbo.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2607
2016-12-03 15:44:15 +00:00
Even Rouault
5b52559d39 * tools/tiffcp.c: avoid potential division by zero is BitsPerSamples tag is
missing.
Reported by Agostino sarubbo.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2597
2016-12-03 14:42:40 +00:00
Even Rouault
78dab0996f * tools/tiffcp.c: avoid uint32 underflow in cpDecodedStrips that
can cause various issues, such as buffer overflows in the library.
Reported by Agostino Sarubbo.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2598
2016-12-02 22:13:32 +00:00
Even Rouault
6f13bf391a * tools/tiffcp.c: fix out-of-bounds write on tiled images with odd
tile width vs image width. Reported as MSVR 35103
by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities &
Mitigations team.
2016-10-08 15:54:56 +00:00
Even Rouault
5707841070 * tools/tiffcp.c: fix read of undefined variable in case of missing
required tags. Found on test case of MSVR 35100.
* tools/tiffcrop.c: fix read of undefined buffer in
readContigStripsIntoBuffer() due to uint16 overflow. Probably not a
security issue but I can be wrong. Reported as MSVR 35100 by Axel
Souchet from the MSRC Vulnerabilities & Mitigations team.
2016-10-08 15:04:31 +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
8942af3dfe * tools/tiffcp.c: Fix Coverity 1024306, 1024307, 1024308, 1024309
"Resource leak".
2015-05-28 13:17:35 +00:00
Even Rouault
2dae28a91b * 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 16:28:37 +00:00
Tom Lane
feb6bd9f1d Sync tool usage printouts and man pages with reality. 2013-03-06 03:35:09 +00:00
Andrey Kiselev
d499ffbfcd Added support for specifying the compression level parameter (preset) for
Deflate and LZMA encoders, e.g "-c lzma:p1" or "-c zip:p9".
2010-12-23 13:38:47 +00:00
Andrey Kiselev
a2d72c2dd4 Implement a new TIFF compression scheme LZMA reserving a new value 34925 for
Compression tag. As per bug http://bugzilla.maptools.org/show_bug.cgi?id=2221
2010-12-14 12:52:59 +00:00
Andrey Kiselev
aa50cfd0aa *** empty log message *** 2010-06-25 12:24:13 +00:00
Bob Friesenhahn
bbf76bce0f * tools/tiffcp.c (tiffcp): Applied Tom Lane's patch to reject
YCbCr subsampled data since tiffcp currently doesn't support it.
http://bugzilla.maptools.org/show_bug.cgi?id=2097
2010-06-11 21:23:12 +00:00
Bob Friesenhahn
d36017b938 * libtiff/tif_fax3.c (Fax3SetupState): Yesterday's fix for
CVE-2010-1411 was not complete.

* libtiff/tiffiop.h (TIFFSafeMultiply): New macro to safely
multiply two integers.  Returns zero if there is an integer
overflow.

* tools/tiffcp.c (main): tiffcp should not leak memory if an error
is reported when reading the input file.
2010-06-09 17:17:13 +00:00
Frank Warmerdam
13ab8a93b6 added -x switch to tiffcp to (re)number allt he pages (#2203) 2010-06-03 17:01:01 +00:00
Bob Friesenhahn
4e0d97f83c * libtiff/tif_aux.c (_TIFFCheckRealloc): Improve error message so
that it is clearly a memory allocation error message, and also
includes the size of the allocation request.
2010-03-10 18:56:48 +00:00
Frank Warmerdam
f4da7ed52e add -c sgilog to tiffcp, add minimal logluv testing 2009-06-30 17:25:26 +00:00
Bob Friesenhahn
953d02c32d * libtiff/tiffio.h: GCC will now validate format specifications
for TIFFError(), TIFFErrorExt(), TIFFWarning(), and
TIFFWarningExt() in order to reveal bugs.
* Many fixes throughout to work better as a 64-bit build.
2008-12-31 23:48:01 +00:00
Frank Warmerdam
09fe8fabf4 fix some coverity reported problems 2008-05-23 17:24:41 +00:00
Joris Van Damme
70b42a0259 BigTIFF upgrade: tiffcp.c 2007-06-20 08:36:42 +00:00
Joris Van Damme
4bd2d780ce BigTIFF upgrade: tiffcp.c 2007-06-20 08:35:57 +00:00
Andrey Kiselev
db88776e03 Do not change RowsPerStrip value if it was set as infinite. As per bug:
http://bugzilla.remotesensing.org/show_bug.cgi?id=1368
2007-02-24 15:57:01 +00:00
Andrey Kiselev
01a173d4b8 Added help line for 'jbig' compression option. 2006-06-07 16:34:32 +00:00
Andrey Kiselev
9ff07be06c Added support for JBIG compression scheme (34661 code) contributed by Lee
Howard. As per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=896
2006-06-07 15:47:43 +00:00
Andrey Kiselev
b5a9d9642e Do not set RowsPerStrip bigger than image length. 2006-03-21 16:24:33 +00:00
Frank Warmerdam
3949657664 fix jpeg tool option processing: bug 1025 2006-01-11 16:59:35 +00:00
Andrey Kiselev
038f178e4b Added many error reporting messages; fixed integer overflow as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=789
2005-12-20 16:50:21 +00:00
Andrey Kiselev
52cdf33845 Return non-zero status when reading fails (again). 2005-12-14 13:59:52 +00:00
Andrey Kiselev
b1ec8c0aee Return non-zero status when reading fails. 2005-12-13 16:42:39 +00:00
Andrey Kiselev
d83db532b1 Fixed WhitePoint tag copying. 2005-07-06 11:38:17 +00:00
Andrey Kiselev
e09ee59337 Use Adobe Deflate compression code instead of old deflate code. 2005-04-15 17:50:09 +00:00
Andrey Kiselev
6e08e7728d Avoid warnings. 2004-09-21 13:24:00 +00:00
Andrey Kiselev
1016e7081c *** empty log message *** 2004-09-08 18:01:29 +00:00
Andrey Kiselev
b75684f6ba Warnings removed. 2004-09-02 14:46:27 +00:00
Andrey Kiselev
c79429f4fe Removed message about LZW patents. 2004-07-24 19:03:16 +00:00
Frank Warmerdam
5a1af25943 close out on normal termination 2004-05-19 15:16:45 +00:00
Andrey Kiselev
8d2cb0f304 MSVC updates. 2004-04-15 10:44:32 +00:00
Andrey Kiselev
1371eb08d4 Properly set Photometric Interpretation in case of JPEG compression of
grayscale images.
2004-03-26 15:52:47 +00:00
Andrey Kiselev
c6cfb9d49b Don't emit warnings when Orientation tag does not present in the input image. 2004-03-26 11:39:31 +00:00
Andrey Kiselev
8a0e796bf4 *** empty log message *** 2004-02-05 15:40:31 +00:00
Andrey Kiselev
3a8ae673b7 Fixed problem with wrong interpretation of the InkNames tag as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=466
Memory leak fixed.
2004-01-28 12:12:01 +00:00
Andrey Kiselev
58117ffafa Get rid of C++ style comments. 2004-01-26 17:00:55 +00:00
Andrey Kiselev
17ea33280e Fixed problem with wrong Photometric setting for non-RGB images. 2004-01-02 10:02:14 +00:00