Commit Graph

3574 Commits

Author SHA1 Message Date
Vadim Zeitlin
af035310bd Remove test for snprintf() from configure and elsewhere
This is needed to work around a build failure when this test fails, as
it spuriously does when cross-compiling for MinGW using v10 API package,
see https://sourceforge.net/p/mingw-w64/bugs/935/ for more details.

Of course, the fact that the build fails if snprintf() is unavailable is
actually a bug, but in practice this function is available everywhere by
now, so simply stop testing for it.

This mostly cherry picks ceff22ee (Use C99 snprintf, 2021-01-31), but
keeps the test for MSVC versions without vsnprintf() for compatibility.
2022-04-14 00:20:56 +02:00
Even Rouault
4610f67218 tif_lzw.c: silence compiler warning about set but not used variable with recent clang 2022-03-20 15:55:57 +01:00
Vadim Zeitlin
28ce1ef089 Revert "Added stdint.h"
This reverts commit fb84e7396b which seems
to have added unnecessary stdint.h inclusion breaking compilation with
ancient MSVS version not providing this file.
2020-12-31 14:36:48 +01:00
Vadim Zeitlin
e9b9266648 Avoid gcc -Wundef warnings in tif_zip.c
Test LIBDEFLATE_SUPPORT using #ifdef, not #if. This avoids the warnings
and is consistent with the other similar settings, e.g. JBIG_SUPPORT.
2020-12-30 23:25:03 +01:00
Vadim Zeitlin
193c1c7394 Create tag for v4.2.0
-----BEGIN PGP SIGNATURE-----
 
 iHUEABEIAB0WIQTr39shsCDuj9FRqI3jAQR94RmJdQUCX95KfAAKCRDjAQR94RmJ
 ddHsAP9aNuHBYnueUqBjE34GjNwgwh8rt01MrUT6qYLBomlClgD+L3Xed/AbZH6k
 k3RLq2Wyd7YPMyi6/I9FbIw5av98Dis=
 =RqwF
 -----END PGP SIGNATURE-----

Merge tag 'v4.2.0' into wx

Update to the latest upstream release and rerun autogen.sh.
2020-12-30 17:56:13 +01:00
Bob Friesenhahn
4862b0d7bc Changes for 4.2.0 release 2020-12-19 12:44:58 -06:00
Bob Friesenhahn
25934c94fc Changes for 4.2.0 release 2020-12-19 12:37:12 -06:00
Even Rouault
7ec02eaa81 Merge branch 'w_adjust-deflate_names' into 'master'
Set 'deflate' to DEFLATE_NAMES, instead of 'libdeflate'

See merge request libtiff/libtiff!174
2020-12-12 21:56:16 +00:00
Lemures Lemniscati
dd38d7cb1b Set 'deflate' to DEFLATE_NAMES, instead of 'libdeflate'
'lib' will be automatically added as a prefix while doing find_library()
2020-12-13 06:30:46 +09:00
Even Rouault
9a935c7e23
DoubleToRational(): avoid casting NaN to uint32 (fixes #227) 2020-12-12 15:31:05 +01:00
Even Rouault
39d6c91ffd Merge branch 'fix_221' into 'master'
tiffio.h: do not define __attribute__ but defines TIFF_ATTRIBUTE instead (fixes #221)

Closes #221

See merge request libtiff/libtiff!173
2020-12-12 14:27:39 +00:00
Even Rouault
a12d22b7b3
tiffio.h: do not define __attribute__ but defines TIFF_ATTRIBUTE instead (fixes #221) 2020-12-12 15:03:38 +01:00
Even Rouault
f13cf46b6e
TIFFReadDirEntryArrayWithLimit(): properly read from offline tag value when we clamp the number of strips to 1.
Fixes regression of commit 7057734d98 on reading
a file with StripByteCounts with 1 element (broken) and StripOffsets with
896 elements, and where StripOffsets[0] is correct

$ tiffdump foo.tif
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 25725448 (0x1888a08) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) LONG (4) 1<640>
ImageLength (257) LONG (4) 1<20098>
BitsPerSample (258) SHORT (3) 1<16>
Photometric (262) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
StripByteCounts (279) LONG (4) 1<1806>
StripOffsets (273) LONG (4) 896<8 648 1288 1928 2568 3208 3848 4488 5128 5768 6408 7048 7688 8328 8968 9608 10248 10888 11528 12168 12808 13448 14088 14728 ...>
2020-12-08 16:13:55 +01:00
Even Rouault
4ca3e42517
tif_jpeg.c: avoid potential harmless unsigned integer overflow on data->fileoffset in JPEGFixupTagsSubsamplingSkip() by validating earlier. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28200 2020-12-02 10:09:16 +01:00
Even Rouault
0f013e5b5a Merge branch 'Jamaika1-master-patch-47839' into 'master'
Change ULARGE_INTEGER to LARGE_INTEGER

See merge request libtiff/libtiff!170
2020-11-27 22:52:10 +00:00
Even Rouault
fd07f243d3 Merge branch 'Jamaika1-master-patch-46397' into 'master'
Added stdint.h

See merge request libtiff/libtiff!171
2020-11-27 22:49:43 +00:00
Jamaika
fb84e7396b Added stdint.h 2020-11-27 22:22:04 +00:00
Jamaika
cf89688896 ```
tif_win32.c: In function '_tiffSizeProc':
tif_win32.c:159:23: warning: passing argument 2 of 'GetFileSizeEx' from incompatible pointer type [-Wincompatible-pointer-types]
  159 |  if (GetFileSizeEx(fd,&m))
      |                       ^~
      |                       |
      |                       ULARGE_INTEGER *
In file included from c:\msys1021\x86_64-w64-mingw32\include\winbase.h:18,
                 from c:\msys1021\x86_64-w64-mingw32\include\windows.h:70,
                 from tif_win32.c:32:
c:\msys1021\x86_64-w64-mingw32\include\fileapi.h:78:73: note: expected 'PLARGE_INTEGER' {aka 'LARGE_INTEGER *'} but argument is of type 'ULARGE_INTEGER *'
   78 |   WINBASEAPI WINBOOL WINAPI GetFileSizeEx (HANDLE hFile, PLARGE_INTEGER lpFileSize);
      |                                                          ~~~~~~~~~~~~~~~^~~~~~~~~~
```
2020-11-27 22:02:04 +00:00
Even Rouault
9dce07a777 Merge branch 'issue-113' into 'master'
tiffcrop: fix buffer overrun in extractContigSamples24bits()

Closes #113

See merge request libtiff/libtiff!169
2020-11-21 17:35:18 +00:00
Even Rouault
59e38422f1 Merge branch 'issue-156' into 'master'
tiff2pdf: Check output size before writing

Closes #156

See merge request libtiff/libtiff!168
2020-11-21 17:33:59 +00:00
Even Rouault
b53b6d9abb Merge branch 'issue-201' into 'master'
tiff2pdf: enforce memory limit for tiled pictures too

Closes #201

See merge request libtiff/libtiff!167
2020-11-21 17:33:08 +00:00
Even Rouault
b5a935d96b Merge branch 'issue-207' into 'master'
enforce (configurable) memory limit in tiff2rgba

Closes #209 et #207

See merge request libtiff/libtiff!165
2020-11-20 22:04:34 +00:00
Even Rouault
69c6b52663
tif_lzw.c: avoid false positive -Wnull-dereference of mingw32 gcc 7.3 2020-11-20 14:12:38 +01:00
Thomas Bernard
916c1a4f8b
tiffcrop: fix buffer overrun in extractContigSamples24bits()
fixes #113
2020-11-18 01:47:11 +01:00
Thomas Bernard
6605513d24
tiff2pdf: Check output size before writing
fixes #156
2020-11-18 01:22:04 +01:00
Thomas Bernard
9c927442d3
tiff2pdf: enforce memory limit for tiled pictures too
fixes #201
2020-11-18 00:35:48 +01:00
Thomas Bernard
e9e504193e
tiff2rgba.1: -M option 2020-11-15 17:08:42 +01:00
Thomas Bernard
98a254f5b9 enforce (configurable) memory limit in tiff2rgba
fixes #207
fixes #209
2020-11-15 17:02:51 +01:00
Even Rouault
dadd8c7dce Merge branch 'issue-220' into 'master'
tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr

Closes #220

See merge request libtiff/libtiff!159
2020-11-14 12:53:01 +00:00
Thomas Bernard
7be2e452dd tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr
fixes #220
2020-11-14 12:53:01 +00:00
Even Rouault
bf84e70665 Merge branch 'issue-204' into 'master'
avoid buffer overflow while writing jpeg end of file marker

Closes #204

See merge request libtiff/libtiff!161
2020-11-14 12:51:06 +00:00
Even Rouault
7ade760d79 Merge branch 'issue-193' into 'master'
fix buffer overflow in tiff2ps.c

Closes #193

See merge request libtiff/libtiff!162
2020-11-14 12:50:05 +00:00
Even Rouault
026c2bce9f Merge branch 'skal65535-master-patch-91082' into 'master'
More overflow fixes for large widths

See merge request libtiff/libtiff!164
2020-11-14 12:44:43 +00:00
skal
2105b200df More overflow fixes for large width
Also: use INT_MAX instead of hard-coded constants.
2020-11-14 08:57:59 +00:00
Even Rouault
d40507b815 Merge branch 'skal65535-master-patch-56655' into 'master'
Fix potential overflow in gtStripContig()

See merge request libtiff/libtiff!163
2020-11-12 15:52:56 +00:00
Even Rouault
d167fbb6af Merge branch 'issue-211' into 'master'
check for tile width overflow

Closes #211

See merge request libtiff/libtiff!160
2020-11-12 15:52:43 +00:00
skal
ce70d17ee6 Fix potential overflow in gtStripContig()
(w + w) might not fit in int32 if too large.
2020-11-12 15:41:14 +00:00
Thomas Bernard
b7cc4f7ef1
tiff2ps.c: fix buffer overread
fixes #193
2020-11-10 03:00:27 +01:00
Thomas Bernard
19ff8a6e97
fix undefined behaviour (int shifted too much to the left) 2020-11-10 03:00:12 +01:00
Thomas Bernard
a61c255236
avoid buffer overflow while writing jpeg end of file marker
fixes #204
2020-11-10 02:35:53 +01:00
Thomas Bernard
c8d613ef49
gtTileContig(): check Tile width for overflow
fixes #211
2020-11-10 02:10:31 +01:00
Thomas Bernard
712fe9f5b9
fix warning messages (v32 is unsigned) 2020-11-10 01:53:56 +01:00
Even Rouault
2e822691d7
TIFFStartStrip(): avoid potential crash in WebP codec when using scanline access on corrupted files. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26650 2020-10-26 11:32:42 +01:00
Even Rouault
b0469e8157
tif_webp.c: validate tile/strip dimension to avoid unsigned integer overflow in RGBA.size computation 2020-10-20 13:47:16 +02:00
Even Rouault
8aec9c8d29
tif_zip.c: fix typo in comment 2020-10-19 14:25:40 +02:00
Even Rouault
3550db1ad2
tiff.h: remove irrelevant warning about webp related pseudo-tags not being registered: they are purely internal libtiff concepts 2020-10-16 15:23:56 +02:00
Even Rouault
0047ca708b Merge branch 'libdeflate' into 'master'
Add support for building against libdeflate for faster Zip/Deflate compression/decompression

See merge request libtiff/libtiff!158
2020-10-16 13:22:06 +00:00
Even Rouault
b9fa1f6e4a
test: add testdeflatelaststripextradata.sh 2020-10-16 13:40:11 +02:00
Even Rouault
3a2de853a9
Add support for optional building against libdeflate for faster Zip/Deflate compression/decompression.
So we can have 2 kind of builds with the Zip/Deflate codec:
- zlib only
- zlib + libdeflate

Speed improvements in the 35%-50% range can be expected when libdeflate is used.
Compression level up to 12 is now supported (capped to 9 when zlib is used).
Still requires zlib for situations where libdeflate cannot be used (that
is for scanline access, since libdeflate has no streaming mode)

Pseudo-tag TIFFTAG_DEFLATE_SUBCODEC=DEFLATE_SUBCODEC_ZLIB/DEFLATE_SUBCODEC_LIBDEFLATE
is added to control which subcodec (zlib or libdeflate) should be used (it defaults
of course to libdeflate, when it is available).
This is mostly aimed at being used on the writing side, to be able to reproduce
output of previous libtiff versions at a binary level, in situations where this would
be really needed. Or as a safety belt in case there would be unforeseen issues
with using libdeflate.
It can be used to know when libdeflate is available at runtime (DEFLATE_SUBCODEC_LIBDEFLATE
will be the default value in that situation).

Of course, deflate codestreams produced by libdeflate can be read by zlib, and vice-versa.
2020-10-16 13:40:10 +02:00
Even Rouault
ac64d74bdf
tif_webp.c: fix compiler warnings with MSVC 2020-10-14 14:39:50 +02:00