Commit Graph

60 Commits

Author SHA1 Message Date
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
Andrey Kiselev
bf02156034 *** empty log message *** 2003-12-20 13:46:57 +00:00
Frank Warmerdam
8c657db1a6 Avoid warning casting signed value to unsigned variable.
Patch supplied by J.A. Strother.
2003-07-26 03:50:08 +00:00
Andrey Kiselev
2f4d3521b4 Added possibility to specify value -1 to -r option to get the entire image
as one strip. See http://bugzilla.remotesensing.org/show_bug.cgi?id=343
for details.
2003-06-10 06:15:36 +00:00
Andrey Kiselev
b446eb0782 Set the correct RowsPerStrip and PageNumber values as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=343
2003-06-04 10:36:54 +00:00
Andrey Kiselev
8415e87d3e Some more fixes to bug entry
http://bugzilla.remotesensing.org/show_bug.cgi?id=275
2003-04-21 19:13:59 +00:00