diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2017-11-19 21:51:35 +0100 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2017-11-19 21:52:26 +0100 |
commit | 249ac401ff26eaed63135c2732186a1f98e13eb0 (patch) | |
tree | 7a2ac9d15b2c8f3dd4d2feee166da05342fa5686 /media-libs | |
parent | media-libs/tiff: Bump to version 4.0.9 (diff) | |
download | gentoo-249ac401ff26eaed63135c2732186a1f98e13eb0.tar.gz gentoo-249ac401ff26eaed63135c2732186a1f98e13eb0.tar.bz2 gentoo-249ac401ff26eaed63135c2732186a1f98e13eb0.zip |
media-libs/tiff: Removed old.
Package-Manager: Portage-2.3.14, Repoman-2.3.6
Diffstat (limited to 'media-libs')
40 files changed, 0 insertions, 2231 deletions
diff --git a/media-libs/tiff/Manifest b/media-libs/tiff/Manifest index bee82d59f002..2b2df775d4ea 100644 --- a/media-libs/tiff/Manifest +++ b/media-libs/tiff/Manifest @@ -1,4 +1,3 @@ DIST tiff-3.9.7.tar.gz 1468097 SHA256 f5d64dd4ce61c55f5e9f6dc3920fbe5a41e02c2e607da7117a35eb5c320cef6a SHA512 ca89584a9ffa33b4986e4bc2165043cec239896f1f0ab73db00818d0442b570efaa6345b2ed422e884202324d359713df849bf14782bb0cf3b959655febddd77 WHIRLPOOL c06b35da66c365c1fe7f0e6e06a400e139d3e2b5b280aa764015c2f0383a6191ffb3d335cdf2211b687bbb0caacf641be409148986a9813dfde5822a650a9b1c -DIST tiff-4.0.7.tar.gz 2076392 SHA256 9f43a2cfb9589e5cecaa66e16bf87f814c945f22df7ba600d63aac4632c4f019 SHA512 941357bdd5f947cdca41a1d31ae14b3fadc174ae5dce7b7981dbe58f61995f575ac2e97a7cc4fcc435184012017bec0920278263490464644f2cdfad9a6c5ddc WHIRLPOOL 3090a0d8a5ad3595c97888edab3c48379175cad993567d20be5f397b1c5c1d21012de55c5da5e664ee483d294fe9eb5f3464e14f564fb79c1357094ff67e313d DIST tiff-4.0.8.tar.gz 2065574 SHA256 59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910 SHA512 5d010ec4ce37aca733f7ab7db9f432987b0cd21664bd9d99452a146833c40f0d1e7309d1870b0395e947964134d5cfeb1366181e761fe353ad585803ff3d6be6 WHIRLPOOL 13fce447c586fef080c6201f0f5b010bc8b0e096bc9b806ab3b80eb6a672c789f88b5fc34a51585aa7072bb8407ecc958d1d7824fad379f86968f051de2fa96d DIST tiff-4.0.9.tar.gz 2305681 SHA256 6e7bdeec2c310734e734d19aae3a71ebe37a4d842e0e23dbb1b8921c0026cfcd SHA512 04f3d5eefccf9c1a0393659fe27f3dddd31108c401ba0dc587bca152a1c1f6bc844ba41622ff5572da8cc278593eff8c402b44e7af0a0090e91d326c2d79f6cd WHIRLPOOL e67378d8d7c17d892e5f075d4e13aa299042a9f989fd6051b23d986518a11f2bbbcb13f491d87da6e6455aa28df2cce0fb65761237e256ac2e37889272f2ddf7 diff --git a/media-libs/tiff/files/tiff-4.0.7-CVE-2016-10266.patch b/media-libs/tiff/files/tiff-4.0.7-CVE-2016-10266.patch deleted file mode 100644 index 67e0ca41c995..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-CVE-2016-10266.patch +++ /dev/null @@ -1,46 +0,0 @@ -http://bugzilla.maptools.org/show_bug.cgi?id=2596 - -From d7520d28685b96a28421ef01fb66cea8d1a96dfc Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Fri, 2 Dec 2016 21:56:56 +0000 -Subject: [PATCH] * libtiff/tif_read.c, libtiff/tiffiop.h: fix uint32 overflow - in TIFFReadEncodedStrip() that caused an integer division by zero. Reported - by Agostino Sarubbo. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2596 - ---- - ChangeLog | 7 +++++++ - libtiff/tif_read.c | 4 ++-- - libtiff/tiffiop.h | 6 +++++- - 3 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c -index 80035929f033..29a311db0cb7 100644 ---- a/libtiff/tif_read.c -+++ b/libtiff/tif_read.c -@@ -346,7 +346,7 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) - rowsperstrip=td->td_rowsperstrip; - if (rowsperstrip>td->td_imagelength) - rowsperstrip=td->td_imagelength; -- stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip); -+ stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip); - stripinplane=(strip%stripsperplane); - plane=(uint16)(strip/stripsperplane); - rows=td->td_imagelength-stripinplane*rowsperstrip; -diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h -index 8bcd0c172c08..5294ee78ffaf 100644 ---- a/libtiff/tiffiop.h -+++ b/libtiff/tiffiop.h -@@ -250,6 +250,10 @@ struct tiff { - #define TIFFhowmany_32(x, y) (((uint32)x < (0xffffffff - (uint32)(y-1))) ? \ - ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) : \ - 0U) -+/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */ -+/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */ -+#define TIFFhowmany_32_maxuint_compat(x, y) \ -+ (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0)) - #define TIFFhowmany8_32(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3) - #define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y)) - #define TIFFhowmany_64(x, y) ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y))) --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-CVE-2016-10267.patch b/media-libs/tiff/files/tiff-4.0.7-CVE-2016-10267.patch deleted file mode 100644 index 04d9729ff731..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-CVE-2016-10267.patch +++ /dev/null @@ -1,53 +0,0 @@ -http://bugzilla.maptools.org/show_bug.cgi?id=2611 - -From bd06f6c97dff0b30de0f80227d782ea448c14b19 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 11:15:18 +0000 -Subject: [PATCH] * libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case - of failure in OJPEGPreDecode(). This will avoid a divide by zero, and - potential other issues. Reported by Agostino Sarubbo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2611 - ---- - ChangeLog | 7 +++++++ - libtiff/tif_ojpeg.c | 10 +++++++++- - 2 files changed, 16 insertions(+), 1 deletion(-) - -diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c -index 30a1812634e0..93839d8f3e11 100644 ---- a/libtiff/tif_ojpeg.c -+++ b/libtiff/tif_ojpeg.c -@@ -244,6 +244,7 @@ typedef enum { - - typedef struct { - TIFF* tif; -+ int decoder_ok; - #ifndef LIBJPEG_ENCAP_EXTERNAL - JMP_BUF exit_jmpbuf; - #endif -@@ -722,6 +723,7 @@ OJPEGPreDecode(TIFF* tif, uint16 s) - } - sp->write_curstrile++; - } -+ sp->decoder_ok = 1; - return(1); - } - -@@ -784,8 +786,14 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif) - static int - OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) - { -+ static const char module[]="OJPEGDecode"; - OJPEGState* sp=(OJPEGState*)tif->tif_data; - (void)s; -+ if( !sp->decoder_ok ) -+ { -+ TIFFErrorExt(tif->tif_clientdata,module,"Cannot decode: decoder not correctly initialized"); -+ return 0; -+ } - if (sp->libjpeg_jpeg_query_style==0) - { - if (OJPEGDecodeRaw(tif,buf,cc)==0) --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-CVE-2017-5225.patch b/media-libs/tiff/files/tiff-4.0.7-CVE-2017-5225.patch deleted file mode 100644 index 7f961474ba9c..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-CVE-2017-5225.patch +++ /dev/null @@ -1,74 +0,0 @@ -https://bugs.gentoo.org/610330 - -From 24bc05876f5a1a300a3c4eb0fa8e8cea6a256f9f Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 19:25:44 +0000 -Subject: [PATCH] * 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 - ---- - ChangeLog | 7 +++++++ - tools/tiffcp.c | 26 +++++++++++++++++++++++--- - 2 files changed, 30 insertions(+), 3 deletions(-) - -diff --git a/tools/tiffcp.c b/tools/tiffcp.c -index 49c9d37125a6..489459a7f6a4 100644 ---- a/tools/tiffcp.c -+++ b/tools/tiffcp.c -@@ -591,7 +591,7 @@ static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16); - static int - tiffcp(TIFF* in, TIFF* out) - { -- uint16 bitspersample, samplesperpixel = 1; -+ uint16 bitspersample = 1, samplesperpixel = 1; - uint16 input_compression, input_photometric = PHOTOMETRIC_MINISBLACK; - copyFunc cf; - uint32 width, length; -@@ -1067,6 +1067,16 @@ DECLAREcpFunc(cpContig2SeparateByRow) - register uint32 n; - uint32 row; - tsample_t s; -+ uint16 bps = 0; -+ -+ (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps); -+ if( bps != 8 ) -+ { -+ TIFFError(TIFFFileName(in), -+ "Error, can only handle BitsPerSample=8 in %s", -+ "cpContig2SeparateByRow"); -+ return 0; -+ } - - inbuf = _TIFFmalloc(scanlinesizein); - outbuf = _TIFFmalloc(scanlinesizeout); -@@ -1120,6 +1130,16 @@ DECLAREcpFunc(cpSeparate2ContigByRow) - register uint32 n; - uint32 row; - tsample_t s; -+ uint16 bps = 0; -+ -+ (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps); -+ if( bps != 8 ) -+ { -+ TIFFError(TIFFFileName(in), -+ "Error, can only handle BitsPerSample=8 in %s", -+ "cpSeparate2ContigByRow"); -+ return 0; -+ } - - inbuf = _TIFFmalloc(scanlinesizein); - outbuf = _TIFFmalloc(scanlinesizeout); -@@ -1784,7 +1804,7 @@ pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel) - uint32 w, l, tw, tl; - int bychunk; - -- (void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv); -+ (void) TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &shortv); - if (shortv != config && bitspersample != 8 && samplesperpixel > 1) { - fprintf(stderr, - "%s: Cannot handle different planar configuration w/ bits/sample != 8\n", --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2130.patch b/media-libs/tiff/files/tiff-4.0.7-bug2130.patch deleted file mode 100644 index b565fecc029b..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2130.patch +++ /dev/null @@ -1,112 +0,0 @@ -From c2faaeaa7887c24c574297e8e2f36208df9dc229 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 20:33:35 +0000 -Subject: [PATCH] * libtiff/tif_luv.c, tif_lzw.c, tif_packbits.c: return 0 in - Encode functions instead of -1 when TIFFFlushData1() fails. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2130 - ---- - ChangeLog | 6 ++++++ - libtiff/tif_luv.c | 12 ++++++------ - libtiff/tif_lzw.c | 8 +++++--- - libtiff/tif_packbits.c | 6 +++--- - 4 files changed, 20 insertions(+), 12 deletions(-) - -diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c -index f42ac0131fee..1f6d8ba3ea5a 100644 ---- a/libtiff/tif_luv.c -+++ b/libtiff/tif_luv.c -@@ -473,7 +473,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) - tif->tif_rawcp = op; - tif->tif_rawcc = tif->tif_rawdatasize - occ; - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - occ = tif->tif_rawdatasize - tif->tif_rawcc; - } -@@ -505,7 +505,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) - tif->tif_rawcp = op; - tif->tif_rawcc = tif->tif_rawdatasize - occ; - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - occ = tif->tif_rawdatasize - tif->tif_rawcc; - } -@@ -565,7 +565,7 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) - tif->tif_rawcp = op; - tif->tif_rawcc = tif->tif_rawdatasize - occ; - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - occ = tif->tif_rawdatasize - tif->tif_rawcc; - } -@@ -624,7 +624,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) - tif->tif_rawcp = op; - tif->tif_rawcc = tif->tif_rawdatasize - occ; - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - occ = tif->tif_rawdatasize - tif->tif_rawcc; - } -@@ -656,7 +656,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) - tif->tif_rawcp = op; - tif->tif_rawcc = tif->tif_rawdatasize - occ; - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - occ = tif->tif_rawdatasize - tif->tif_rawcc; - } -diff --git a/libtiff/tif_lzw.c b/libtiff/tif_lzw.c -index 240e19c2e058..5ba35ec1305f 100644 ---- a/libtiff/tif_lzw.c -+++ b/libtiff/tif_lzw.c -@@ -969,7 +969,8 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) - */ - if (op > limit) { - tif->tif_rawcc = (tmsize_t)(op - tif->tif_rawdata); -- TIFFFlushData1(tif); -+ if( !TIFFFlushData1(tif) ) -+ return 0; - op = tif->tif_rawdata; - } - PutNextCode(op, ent); -@@ -1054,7 +1055,8 @@ LZWPostEncode(TIFF* tif) - - if (op > sp->enc_rawlimit) { - tif->tif_rawcc = (tmsize_t)(op - tif->tif_rawdata); -- TIFFFlushData1(tif); -+ if( !TIFFFlushData1(tif) ) -+ return 0; - op = tif->tif_rawdata; - } - if (sp->enc_oldcode != (hcode_t) -1) { -diff --git a/libtiff/tif_packbits.c b/libtiff/tif_packbits.c -index d2a0165de9dd..0495e688a6be 100644 ---- a/libtiff/tif_packbits.c -+++ b/libtiff/tif_packbits.c -@@ -99,7 +99,7 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) - slop = (long)(op - lastliteral); - tif->tif_rawcc += (tmsize_t)(lastliteral - tif->tif_rawcp); - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - while (slop-- > 0) - *op++ = *lastliteral++; -@@ -107,7 +107,7 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) - } else { - tif->tif_rawcc += (tmsize_t)(op - tif->tif_rawcp); - if (!TIFFFlushData1(tif)) -- return (-1); -+ return (0); - op = tif->tif_rawcp; - } - } --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2535.patch b/media-libs/tiff/files/tiff-4.0.7-bug2535.patch deleted file mode 100644 index c44a8f05d20d..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2535.patch +++ /dev/null @@ -1,54 +0,0 @@ -From c4e376852d82936885833441169684267983691f Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 12:51:59 +0000 -Subject: [PATCH] * libtiff/tif_dirwrite.c: in - TIFFWriteDirectoryTagCheckedRational, replace assertion by runtime check to - error out if passed value is strictly negative. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2535 - -* tools/tiffcrop.c: remove extraneous TIFFClose() in error code path, that -caused double free. -Related to http://bugzilla.maptools.org/show_bug.cgi?id=2535 ---- - ChangeLog | 11 +++++++++++ - libtiff/tif_dirwrite.c | 11 ++++++++--- - tools/tiffcrop.c | 3 +-- - 3 files changed, 20 insertions(+), 5 deletions(-) - -diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c -index d34f6f611d39..055324db078f 100644 ---- a/libtiff/tif_dirwrite.c -+++ b/libtiff/tif_dirwrite.c -@@ -2094,10 +2094,15 @@ TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* d - static int - TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value) - { -+ static const char module[] = "TIFFWriteDirectoryTagCheckedRational"; - uint32 m[2]; -- assert(value>=0.0); - assert(sizeof(uint32)==4); -- if (value<=0.0) -+ if( value < 0 ) -+ { -+ TIFFErrorExt(tif->tif_clientdata,module,"Negative value is illegal"); -+ return 0; -+ } -+ else if (value==0.0) - { - m[0]=0; - m[1]=1; -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 21dd08720d77..c69177e052d4 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -7996,7 +7996,6 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image, - if (!TIFFWriteDirectory(out)) - { - TIFFError("","Failed to write IFD for page number %d", pagenum); -- TIFFClose(out); - return (-1); - } - --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2594.patch b/media-libs/tiff/files/tiff-4.0.7-bug2594.patch deleted file mode 100644 index b2bc26e9064c..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2594.patch +++ /dev/null @@ -1,28 +0,0 @@ -From a56820e2022e23610c1ea99fbf621d73d1e36348 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 14:18:48 +0000 -Subject: [PATCH] * tools/tiffinfo.c: fix null pointer dereference in -r mode - when the image has no StripByteCount tag. Reported by Agostino Sarubbo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2594 - ---- - ChangeLog | 7 +++++++ - tools/tiffinfo.c | 4 ++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c -index b02c7d46bed0..4d58055de85c 100644 ---- a/tools/tiffinfo.c -+++ b/tools/tiffinfo.c -@@ -417,7 +417,7 @@ TIFFReadRawData(TIFF* tif, int bitrev) - uint64* stripbc=NULL; - - TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbc); -- if (nstrips > 0) { -+ if (stripbc != NULL && nstrips > 0) { - uint32 bufsize = (uint32) stripbc[0]; - tdata_t buf = _TIFFmalloc(bufsize); - tstrip_t s; --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2597.patch b/media-libs/tiff/files/tiff-4.0.7-bug2597.patch deleted file mode 100644 index 9cd29cfab77b..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2597.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 5ad5e64f8530a827482645986f5bb4e4613d0aa7 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 14:42:40 +0000 -Subject: [PATCH] * 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 - ---- - ChangeLog | 7 +++++++ - tools/tiffcp.c | 10 ++++++++-- - 2 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/tools/tiffcp.c b/tools/tiffcp.c -index 6dfb9a91bfa9..c8e48c3c2bb3 100644 ---- a/tools/tiffcp.c -+++ b/tools/tiffcp.c -@@ -1378,7 +1378,7 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer) - uint8* bufp = (uint8*) buf; - uint32 tw, tl; - uint32 row; -- uint16 bps, bytes_per_sample; -+ uint16 bps = 0, bytes_per_sample; - - tilebuf = _TIFFmalloc(tilesize); - if (tilebuf == 0) -@@ -1387,6 +1387,12 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer) - (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw); - (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl); - (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps); -+ if( bps == 0 ) -+ { -+ TIFFError(TIFFFileName(in), "Error, cannot read BitsPerSample"); -+ status = 0; -+ goto done; -+ } - assert( bps % 8 == 0 ); - bytes_per_sample = bps/8; - --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2598.patch b/media-libs/tiff/files/tiff-4.0.7-bug2598.patch deleted file mode 100644 index c0a0d1a8db1a..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2598.patch +++ /dev/null @@ -1,31 +0,0 @@ -http://bugzilla.maptools.org/show_bug.cgi?id=2598 - -From bc3d7392e43545c7c6375897458a7a3e8ee4d9d8 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Fri, 2 Dec 2016 22:13:32 +0000 -Subject: [PATCH] * 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 - ---- - ChangeLog | 7 +++++++ - tools/tiffcp.c | 4 ++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/tools/tiffcp.c b/tools/tiffcp.c -index 338a3d113bf8..6dfb9a91bfa9 100644 ---- a/tools/tiffcp.c -+++ b/tools/tiffcp.c -@@ -985,7 +985,7 @@ DECLAREcpFunc(cpDecodedStrips) - tstrip_t s, ns = TIFFNumberOfStrips(in); - uint32 row = 0; - _TIFFmemset(buf, 0, stripsize); -- for (s = 0; s < ns; s++) { -+ for (s = 0; s < ns && row < imagelength; s++) { - tsize_t cc = (row + rowsperstrip > imagelength) ? - TIFFVStripSize(in, imagelength - row) : stripsize; - if (TIFFReadEncodedStrip(in, s, buf, cc) < 0 --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2599.patch b/media-libs/tiff/files/tiff-4.0.7-bug2599.patch deleted file mode 100644 index 929bb447bf71..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2599.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 9bbbe303c8e5db20d7f687ee1ca19c98fb852044 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 15:30:31 +0000 -Subject: [PATCH] * tools/tif_dir.c: when TIFFGetField(, TIFFTAG_NUMBEROFINKS, - ) is called, limit the return number of inks to SamplesPerPixel, so that code - that parses ink names doesn't go past the end of the buffer. Reported by - Agostino Sarubbo. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 - -Reported by Agostino Sarubbo. ---- - ChangeLog | 10 +++++++++- - libtiff/tif_dir.c | 28 +++++++++++++++++++++++++++- - 2 files changed, 36 insertions(+), 2 deletions(-) - -diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c -index ad21655a6ee9..2574e748b3be 100644 ---- a/libtiff/tif_dir.c -+++ b/libtiff/tif_dir.c -@@ -854,6 +854,32 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap) - if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */ - return 0; - -+ if( tag == TIFFTAG_NUMBEROFINKS ) -+ { -+ int i; -+ for (i = 0; i < td->td_customValueCount; i++) { -+ uint16 val; -+ TIFFTagValue *tv = td->td_customValues + i; -+ if (tv->info->field_tag != tag) -+ continue; -+ val = *(uint16 *)tv->value; -+ /* Truncate to SamplesPerPixel, since the */ -+ /* setting code for INKNAMES assume that there are SamplesPerPixel */ -+ /* inknames. */ -+ /* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 */ -+ if( val > td->td_samplesperpixel ) -+ { -+ TIFFWarningExt(tif->tif_clientdata,"_TIFFVGetField", -+ "Truncating NumberOfInks from %u to %u", -+ val, td->td_samplesperpixel); -+ val = td->td_samplesperpixel; -+ } -+ *va_arg(ap, uint16*) = val; -+ return 1; -+ } -+ return 0; -+ } -+ - /* - * We want to force the custom code to be used for custom - * fields even if the tag happens to match a well known --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2604.patch b/media-libs/tiff/files/tiff-4.0.7-bug2604.patch deleted file mode 100644 index cc3f4cf3ce91..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2604.patch +++ /dev/null @@ -1,108 +0,0 @@ -From ebc6029128555df725e6ad77a983134350bfc831 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Fri, 2 Dec 2016 23:05:51 +0000 -Subject: [PATCH] * libtiff/tif_pixarlog.c, libtiff/tif_luv.c: fix heap-based - buffer overflow on generation of PixarLog / LUV compressed files, with - ColorMap, TransferFunction attached and nasty plays with bitspersample. The - fix for LUV has not been tested, but suffers from the same kind of issue of - PixarLog. Reported by Agostino Sarubbo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2604 - ---- - ChangeLog | 10 ++++++++++ - libtiff/tif_luv.c | 20 +++++++++++++++----- - libtiff/tif_pixarlog.c | 19 ++++++++++++++++--- - 3 files changed, 41 insertions(+), 8 deletions(-) - -diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c -index ca08f30a76b6..f42ac0131fee 100644 ---- a/libtiff/tif_luv.c -+++ b/libtiff/tif_luv.c -@@ -158,6 +158,7 @@ - typedef struct logLuvState LogLuvState; - - struct logLuvState { -+ int encoder_state; /* 1 if encoder correctly initialized */ - int user_datafmt; /* user data format */ - int encode_meth; /* encoding method */ - int pixel_size; /* bytes per pixel */ -@@ -1552,6 +1553,7 @@ LogLuvSetupEncode(TIFF* tif) - td->td_photometric, "must be either LogLUV or LogL"); - break; - } -+ sp->encoder_state = 1; - return (1); - notsupported: - TIFFErrorExt(tif->tif_clientdata, module, -@@ -1563,19 +1565,27 @@ notsupported: - static void - LogLuvClose(TIFF* tif) - { -+ LogLuvState* sp = (LogLuvState*) tif->tif_data; - TIFFDirectory *td = &tif->tif_dir; - -+ assert(sp != 0); - /* - * For consistency, we always want to write out the same - * bitspersample and sampleformat for our TIFF file, - * regardless of the data format being used by the application. - * Since this routine is called after tags have been set but - * before they have been recorded in the file, we reset them here. -+ * Note: this is really a nasty approach. See PixarLogClose - */ -- td->td_samplesperpixel = -- (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3; -- td->td_bitspersample = 16; -- td->td_sampleformat = SAMPLEFORMAT_INT; -+ if( sp->encoder_state ) -+ { -+ /* See PixarLogClose. Might avoid issues with tags whose size depends -+ * on those below, but not completely sure this is enough. */ -+ td->td_samplesperpixel = -+ (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3; -+ td->td_bitspersample = 16; -+ td->td_sampleformat = SAMPLEFORMAT_INT; -+ } - } - - static void -diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c -index f4af2bab7ce5..9836dce63450 100644 ---- a/libtiff/tif_pixarlog.c -+++ b/libtiff/tif_pixarlog.c -@@ -1233,8 +1233,10 @@ PixarLogPostEncode(TIFF* tif) - static void - PixarLogClose(TIFF* tif) - { -+ PixarLogState* sp = (PixarLogState*) tif->tif_data; - TIFFDirectory *td = &tif->tif_dir; - -+ assert(sp != 0); - /* In a really sneaky (and really incorrect, and untruthful, and - * troublesome, and error-prone) maneuver that completely goes against - * the spirit of TIFF, and breaks TIFF, on close, we covertly -@@ -1243,8 +1245,19 @@ PixarLogClose(TIFF* tif) - * readers that don't know about PixarLog, or how to set - * the PIXARLOGDATFMT pseudo-tag. - */ -- td->td_bitspersample = 8; -- td->td_sampleformat = SAMPLEFORMAT_UINT; -+ -+ if (sp->state&PLSTATE_INIT) { -+ /* We test the state to avoid an issue such as in -+ * http://bugzilla.maptools.org/show_bug.cgi?id=2604 -+ * What appends in that case is that the bitspersample is 1 and -+ * a TransferFunction is set. The size of the TransferFunction -+ * depends on 1<<bitspersample. So if we increase it, an access -+ * out of the buffer will happen at directory flushing. -+ * Another option would be to clear those targs. -+ */ -+ td->td_bitspersample = 8; -+ td->td_sampleformat = SAMPLEFORMAT_UINT; -+ } - } - - static void --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2605.patch b/media-libs/tiff/files/tiff-4.0.7-bug2605.patch deleted file mode 100644 index 335e4348d3f3..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2605.patch +++ /dev/null @@ -1,55 +0,0 @@ -From cd4832257daf222833ae172b3923268fec5b71b9 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 16:50:02 +0000 -Subject: [PATCH] * 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 - ---- - ChangeLog | 6 ++++++ - tools/tiffcp.c | 17 +++++++++++++---- - 2 files changed, 19 insertions(+), 4 deletions(-) - -diff --git a/tools/tiffcp.c b/tools/tiffcp.c -index 6d96bb89f555..49c9d37125a6 100644 ---- a/tools/tiffcp.c -+++ b/tools/tiffcp.c -@@ -45,7 +45,6 @@ - #include <string.h> - - #include <ctype.h> --#include <assert.h> - - #ifdef HAVE_UNISTD_H - # include <unistd.h> -@@ -1393,7 +1392,12 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer) - status = 0; - goto done; - } -- assert( bps % 8 == 0 ); -+ if( (bps % 8) != 0 ) -+ { -+ TIFFError(TIFFFileName(in), "Error, cannot handle BitsPerSample that is not a multiple of 8"); -+ status = 0; -+ goto done; -+ } - bytes_per_sample = bps/8; - - for (row = 0; row < imagelength; row += tl) { -@@ -1584,7 +1588,12 @@ DECLAREwriteFunc(writeBufferToSeparateTiles) - _TIFFfree(obuf); - return 0; - } -- assert( bps % 8 == 0 ); -+ if( (bps % 8) != 0 ) -+ { -+ TIFFError(TIFFFileName(out), "Error, cannot handle BitsPerSample that is not a multiple of 8"); -+ _TIFFfree(obuf); -+ return 0; -+ } - bytes_per_sample = bps/8; - - for (row = 0; row < imagelength; row += tl) { --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2607.patch b/media-libs/tiff/files/tiff-4.0.7-bug2607.patch deleted file mode 100644 index 532259e91cb9..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2607.patch +++ /dev/null @@ -1,41 +0,0 @@ -From c99f44478d6f0491da5b98c8cea14f565a021e22 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 15:44:15 +0000 -Subject: [PATCH] * 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 - ---- - ChangeLog | 7 +++++++ - tools/tiffcp.c | 10 ++++++++-- - 2 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/tools/tiffcp.c b/tools/tiffcp.c -index c8e48c3c2bb3..142cbb0ecfc2 100644 ---- a/tools/tiffcp.c -+++ b/tools/tiffcp.c -@@ -1569,7 +1569,7 @@ DECLAREwriteFunc(writeBufferToSeparateTiles) - uint8* bufp = (uint8*) buf; - uint32 tl, tw; - uint32 row; -- uint16 bps, bytes_per_sample; -+ uint16 bps = 0, bytes_per_sample; - - obuf = _TIFFmalloc(TIFFTileSize(out)); - if (obuf == NULL) -@@ -1578,6 +1578,12 @@ DECLAREwriteFunc(writeBufferToSeparateTiles) - (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl); - (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw); - (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps); -+ if( bps == 0 ) -+ { -+ TIFFError(TIFFFileName(out), "Error, cannot read BitsPerSample"); -+ _TIFFfree(obuf); -+ return 0; -+ } - assert( bps % 8 == 0 ); - bytes_per_sample = bps/8; - --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2608.patch b/media-libs/tiff/files/tiff-4.0.7-bug2608.patch deleted file mode 100644 index afe2c25a293e..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2608.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 92adbddc283782d71d81dbccf72ed2c279f90097 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 11:02:15 +0000 -Subject: [PATCH] * libtiff/tif_dirread.c: modify - ChopUpSingleUncompressedStrip() to instanciate compute ntrips as - TIFFhowmany_32(td->td_imagelength, rowsperstrip), instead of a logic based on - the total size of data. Which is faulty is the total size of data is not - sufficient to fill the whole image, and thus results in reading outside of - the StripByCounts/StripOffsets arrays when using TIFFReadScanline(). Reported - by Agostino Sarubbo. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2608. - -* libtiff/tif_strip.c: revert the change in TIFFNumberOfStrips() done -for http://bugzilla.maptools.org/show_bug.cgi?id=2587 / CVE-2016-9273 since -the above change is a better fix that makes it unnecessary. ---- - ChangeLog | 15 +++++++++++++++ - libtiff/tif_dirread.c | 24 +++++++++++------------- - libtiff/tif_strip.c | 11 +---------- - 3 files changed, 27 insertions(+), 23 deletions(-) - -diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c -index 01070f2ecebd..f2905286c0d0 100644 ---- a/libtiff/tif_dirread.c -+++ b/libtiff/tif_dirread.c -@@ -5502,8 +5502,7 @@ ChopUpSingleUncompressedStrip(TIFF* tif) - uint64 rowblockbytes; - uint64 stripbytes; - uint32 strip; -- uint64 nstrips64; -- uint32 nstrips32; -+ uint32 nstrips; - uint32 rowsperstrip; - uint64* newcounts; - uint64* newoffsets; -@@ -5534,18 +5533,17 @@ ChopUpSingleUncompressedStrip(TIFF* tif) - return; - - /* -- * never increase the number of strips in an image -+ * never increase the number of rows per strip - */ - if (rowsperstrip >= td->td_rowsperstrip) - return; -- nstrips64 = TIFFhowmany_64(bytecount, stripbytes); -- if ((nstrips64==0)||(nstrips64>0xFFFFFFFF)) /* something is wonky, do nothing. */ -- return; -- nstrips32 = (uint32)nstrips64; -+ nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip); -+ if( nstrips == 0 ) -+ return; - -- newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64), -+ newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), - "for chopped \"StripByteCounts\" array"); -- newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64), -+ newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), - "for chopped \"StripOffsets\" array"); - if (newcounts == NULL || newoffsets == NULL) { - /* -@@ -5562,18 +5560,18 @@ ChopUpSingleUncompressedStrip(TIFF* tif) - * Fill the strip information arrays with new bytecounts and offsets - * that reflect the broken-up format. - */ -- for (strip = 0; strip < nstrips32; strip++) { -+ for (strip = 0; strip < nstrips; strip++) { - if (stripbytes > bytecount) - stripbytes = bytecount; - newcounts[strip] = stripbytes; -- newoffsets[strip] = offset; -+ newoffsets[strip] = stripbytes ? offset : 0; - offset += stripbytes; - bytecount -= stripbytes; - } - /* - * Replace old single strip info with multi-strip info. - */ -- td->td_stripsperimage = td->td_nstrips = nstrips32; -+ td->td_stripsperimage = td->td_nstrips = nstrips; - TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip); - - _TIFFfree(td->td_stripbytecount); -diff --git a/libtiff/tif_strip.c b/libtiff/tif_strip.c -index b6098dd31241..6e9f2ef6ddf2 100644 ---- a/libtiff/tif_strip.c -+++ b/libtiff/tif_strip.c -@@ -63,15 +63,6 @@ TIFFNumberOfStrips(TIFF* tif) - TIFFDirectory *td = &tif->tif_dir; - uint32 nstrips; - -- /* If the value was already computed and store in td_nstrips, then return it, -- since ChopUpSingleUncompressedStrip might have altered and resized the -- since the td_stripbytecount and td_stripoffset arrays to the new value -- after the initial affectation of td_nstrips = TIFFNumberOfStrips() in -- tif_dirread.c ~line 3612. -- See http://bugzilla.maptools.org/show_bug.cgi?id=2587 */ -- if( td->td_nstrips ) -- return td->td_nstrips; -- - nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : - TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); - if (td->td_planarconfig == PLANARCONFIG_SEPARATE) --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2610.patch b/media-libs/tiff/files/tiff-4.0.7-bug2610.patch deleted file mode 100644 index f76e83922d6c..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2610.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ee00edfbe833647d59ad87cac82f1b4c0c902179 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 16:40:01 +0000 -Subject: [PATCH] * 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 - ---- - ChangeLog | 7 +++++++ - tools/tiffcp.c | 8 ++++---- - 2 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/tools/tiffcp.c b/tools/tiffcp.c -index 142cbb0ecfc2..6d96bb89f555 100644 ---- a/tools/tiffcp.c -+++ b/tools/tiffcp.c -@@ -1163,7 +1163,7 @@ bad: - - static void - cpStripToTile(uint8* out, uint8* in, -- uint32 rows, uint32 cols, int outskew, int inskew) -+ uint32 rows, uint32 cols, int outskew, int64 inskew) - { - while (rows-- > 0) { - uint32 j = cols; -@@ -1320,7 +1320,7 @@ DECLAREreadFunc(readContigTilesIntoBuffer) - tdata_t tilebuf; - uint32 imagew = TIFFScanlineSize(in); - uint32 tilew = TIFFTileRowSize(in); -- int iskew = imagew - tilew; -+ int64 iskew = (int64)imagew - (int64)tilew; - uint8* bufp = (uint8*) buf; - uint32 tw, tl; - uint32 row; -@@ -1348,7 +1348,7 @@ DECLAREreadFunc(readContigTilesIntoBuffer) - status = 0; - goto done; - } -- if (colb + tilew > imagew) { -+ if (colb > iskew) { - uint32 width = imagew - colb; - uint32 oskew = tilew - width; - cpStripToTile(bufp + colb, --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2619.patch b/media-libs/tiff/files/tiff-4.0.7-bug2619.patch deleted file mode 100644 index 0e0053883a32..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2619.patch +++ /dev/null @@ -1,46 +0,0 @@ -From cb840651f037c59895b67d44b46a34127bb082dd Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 13:00:03 +0000 -Subject: [PATCH] * tools/tiffcrop.c: fix integer division by zero when - BitsPerSample is missing. Reported by Agostina Sarubo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2619 - ---- - ChangeLog | 6 ++++++ - tools/tiffcrop.c | 8 ++++---- - 2 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 9122aab37530..21dd08720d77 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -1164,7 +1164,7 @@ writeBufferToSeparateStrips (TIFF* out, uint8* buf, - tdata_t obuf; - - (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); -- (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps); -+ (void) TIFFGetFieldDefaulted(out, TIFFTAG_BITSPERSAMPLE, &bps); - bytes_per_sample = (bps + 7) / 8; - if( width == 0 || - (uint32)bps * (uint32)spp > TIFF_UINT32_MAX / width || -@@ -4760,7 +4760,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length, - int i, bytes_per_sample, bytes_per_pixel, shift_width, result = 1; - uint32 j; - int32 bytes_read = 0; -- uint16 bps, planar; -+ uint16 bps = 0, planar; - uint32 nstrips; - uint32 strips_per_sample; - uint32 src_rowsize, dst_rowsize, rows_processed, rps; -@@ -4780,7 +4780,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length, - } - - memset (srcbuffs, '\0', sizeof(srcbuffs)); -- TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps); -+ TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps); - TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &planar); - TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps); - if (rps > length) --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2620.patch b/media-libs/tiff/files/tiff-4.0.7-bug2620.patch deleted file mode 100644 index 1b37177c5f91..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2620.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 76c4b35f114bc9614700accd22cc4a0b4b6b92d3 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 11:35:56 +0000 -Subject: [PATCH] * tools/tiffcrop.c: fix readContigStripsIntoBuffer() in -i - (ignore) mode so that the output buffer is correctly incremented to avoid - write outside bounds. Reported by Agostino Sarubbo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2620 - ---- - ChangeLog | 7 +++++++ - tools/tiffcrop.c | 4 ++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 722b132cee6d..bdcbd63ed70b 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -3698,7 +3698,7 @@ static int readContigStripsIntoBuffer (TIFF* in, uint8* buf) - (unsigned long) strip, (unsigned long)rows); - return 0; - } -- bufp += bytes_read; -+ bufp += stripsize; - } - - return 1; --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2621.patch b/media-libs/tiff/files/tiff-4.0.7-bug2621.patch deleted file mode 100644 index 7bb1d57e3e9f..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2621.patch +++ /dev/null @@ -1,49 +0,0 @@ -From d7045ed1501ec99c4e56174813bb1cb5c9a559ef Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 3 Dec 2016 12:19:32 +0000 -Subject: [PATCH] * tools/tiffcrop.c: add 3 extra bytes at end of strip buffer - in readSeparateStripsIntoBuffer() to avoid read outside of heap allocated - buffer. Reported by Agostina Sarubo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2621 - ---- - ChangeLog | 7 +++++++ - tools/tiffcrop.c | 14 ++++++++++++-- - 2 files changed, 19 insertions(+), 2 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index bdcbd63ed70b..9122aab37530 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -4815,10 +4815,17 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length, - nstrips = TIFFNumberOfStrips(in); - strips_per_sample = nstrips /spp; - -+ /* Add 3 padding bytes for combineSeparateSamples32bits */ -+ if( (size_t) stripsize > 0xFFFFFFFFU - 3U ) -+ { -+ TIFFError("readSeparateStripsIntoBuffer", "Integer overflow when calculating buffer size."); -+ exit(-1); -+ } -+ - for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++) - { - srcbuffs[s] = NULL; -- buff = _TIFFmalloc(stripsize); -+ buff = _TIFFmalloc(stripsize + 3); - if (!buff) - { - TIFFError ("readSeparateStripsIntoBuffer", -@@ -4827,6 +4834,9 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length, - _TIFFfree (srcbuffs[i]); - return 0; - } -+ buff[stripsize] = 0; -+ buff[stripsize+1] = 0; -+ buff[stripsize+2] = 0; - srcbuffs[s] = buff; - } - --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2627.patch b/media-libs/tiff/files/tiff-4.0.7-bug2627.patch deleted file mode 100644 index 11a3f3cd3f5c..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2627.patch +++ /dev/null @@ -1,59 +0,0 @@ -From f88bfadb6d1fac1d0d081058216da659e1f5a628 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sun, 18 Dec 2016 22:28:42 +0000 -Subject: [PATCH] * libtiff/tif_getimage.c: fix potential memory leaks in error - code path of TIFFRGBAImageBegin(). Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2627 - ---- - ChangeLog | 6 ++++++ - libtiff/tif_getimage.c | 21 +++++++++------------ - 2 files changed, 15 insertions(+), 12 deletions(-) - -diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c -index c0eb6df0b09a..2ea838556732 100644 ---- a/libtiff/tif_getimage.c -+++ b/libtiff/tif_getimage.c -@@ -283,6 +283,13 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024]) - img->redcmap = NULL; - img->greencmap = NULL; - img->bluecmap = NULL; -+ img->Map = NULL; -+ img->BWmap = NULL; -+ img->PALmap = NULL; -+ img->ycbcr = NULL; -+ img->cielab = NULL; -+ img->UaToAa = NULL; -+ img->Bitdepth16To8 = NULL; - img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */ - - img->tif = tif; -@@ -468,13 +475,6 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024]) - photoTag, img->photometric); - goto fail_return; - } -- img->Map = NULL; -- img->BWmap = NULL; -- img->PALmap = NULL; -- img->ycbcr = NULL; -- img->cielab = NULL; -- img->UaToAa = NULL; -- img->Bitdepth16To8 = NULL; - TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width); - TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height); - TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation); -@@ -494,10 +494,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024]) - return 1; - - fail_return: -- _TIFFfree( img->redcmap ); -- _TIFFfree( img->greencmap ); -- _TIFFfree( img->bluecmap ); -- img->redcmap = img->greencmap = img->bluecmap = NULL; -+ TIFFRGBAImageEnd( img ); - return 0; - } - --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2631.patch b/media-libs/tiff/files/tiff-4.0.7-bug2631.patch deleted file mode 100644 index 6e1011b072dc..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2631.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 101253c74cde97203dab28c4f3bd0994cea5804c Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 14 Jan 2017 13:12:33 +0000 -Subject: [PATCH] * tools/raw2tiff.c: avoid integer division by zero. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2631 - ---- - ChangeLog | 5 +++++ - tools/raw2tiff.c | 10 ++++++++-- - 2 files changed, 13 insertions(+), 2 deletions(-) - -diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c -index 7298e80a95c9..083e9ee73f0f 100644 ---- a/tools/raw2tiff.c -+++ b/tools/raw2tiff.c -@@ -408,8 +408,14 @@ guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32 nbands, - } else if (*width == 0 && *length == 0) { - unsigned int fail = 0; - fprintf(stderr, "Image width and height are not specified.\n"); -+ w = (uint32) sqrt(imagesize / longt); -+ if( w == 0 ) -+ { -+ fprintf(stderr, "Too small image size.\n"); -+ return -1; -+ } - -- for (w = (uint32) sqrt(imagesize / longt); -+ for (; - w < sqrt(imagesize * longt); - w++) { - if (imagesize % w == 0) { --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2633-bug2634.patch b/media-libs/tiff/files/tiff-4.0.7-bug2633-bug2634.patch deleted file mode 100644 index d68e86ebea2f..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2633-bug2634.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 95a32fbbadf54e7527c7e3b66fd603503b29dde9 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 17 Dec 2016 19:45:28 +0000 -Subject: [PATCH] * tools/tiff2ps.c: fix 2 heap-based buffer overflows (in - PSDataBW and PSDataColorContig). Reported by Agostino Sarubbo. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2633 and - http://bugzilla.maptools.org/show_bug.cgi?id=2634. - ---- - ChangeLog | 7 +++++++ - tools/tiff2ps.c | 9 +++++++-- - 2 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c -index 82a5d84b41f5..71df4309ee0c 100644 ---- a/tools/tiff2ps.c -+++ b/tools/tiff2ps.c -@@ -2440,6 +2440,11 @@ PSDataColorContig(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc) - unsigned char *cp, c; - - (void) w; -+ if( es <= 0 ) -+ { -+ TIFFError(filename, "Inconsistent value of es: %d", es); -+ return; -+ } - tf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow); - if (tf_buf == NULL) { - TIFFError(filename, "No space for scanline buffer"); -@@ -2692,7 +2697,7 @@ PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h) - - if (alpha) { - int adjust; -- while (cc-- > 0) { -+ while (cc-- > 1) { - DOBREAK(breaklen, 1, fd); - /* - * For images with alpha, matte against --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2635.patch b/media-libs/tiff/files/tiff-4.0.7-bug2635.patch deleted file mode 100644 index 8756115c9058..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2635.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a7b470d67f2b98599b2c9cd9945db6eea735cc47 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sun, 18 Dec 2016 10:37:59 +0000 -Subject: [PATCH] * tools/tiff2pdf.c: prevent heap-based buffer overflow in -j - mode on a paletted image. Note: this fix errors out before the overflow - happens. There could probably be a better fix. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2635 - ---- - ChangeLog | 7 +++++++ - tools/tiff2pdf.c | 8 +++++++- - 2 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c -index fe8a6ea7e101..afea414bebf6 100644 ---- a/tools/tiff2pdf.c -+++ b/tools/tiff2pdf.c -@@ -3654,6 +3654,12 @@ tsize_t t2p_sample_realize_palette(T2P* t2p, unsigned char* buffer){ - uint32 j=0; - sample_count=t2p->tiff_width*t2p->tiff_length; - component_count=t2p->tiff_samplesperpixel; -+ if( sample_count * component_count > t2p->tiff_datasize ) -+ { -+ TIFFError(TIFF2PDF_MODULE, "Error: sample_count * component_count > t2p->tiff_datasize"); -+ t2p->t2p_error = T2P_ERR_ERROR; -+ return 1; -+ } - - for(i=sample_count;i>0;i--){ - palette_offset=buffer[i-1] * component_count; --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2638.patch b/media-libs/tiff/files/tiff-4.0.7-bug2638.patch deleted file mode 100644 index 15541576c586..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2638.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9f5536843f2ae641542bb81a3023dbc581fac184 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Tue, 20 Dec 2016 17:13:26 +0000 -Subject: [PATCH] * tools/tiff2pdf.c: fix wrong usage of memcpy() that can - trigger unspecified behaviour. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2638 - ---- - ChangeLog | 6 ++++++ - tools/tiff2pdf.c | 5 +++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c -index afea414bebf6..78ffa77d123a 100644 ---- a/tools/tiff2pdf.c -+++ b/tools/tiff2pdf.c -@@ -3593,7 +3593,8 @@ void t2p_tile_collapse_left( - - edgescanwidth = (scanwidth * edgetilewidth + (tilewidth - 1))/ tilewidth; - for(i=0;i<tilelength;i++){ -- _TIFFmemcpy( -+ /* We use memmove() since there can be overlaps in src and dst buffers for the first items */ -+ memmove( - &(((char*)buffer)[edgescanwidth*i]), - &(((char*)buffer)[scanwidth*i]), - edgescanwidth); --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2639.patch b/media-libs/tiff/files/tiff-4.0.7-bug2639.patch deleted file mode 100644 index b894775dc703..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2639.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 6a61192a98665d870dcb835452cb9c5757ccd27c Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Tue, 20 Dec 2016 17:24:35 +0000 -Subject: [PATCH] * tools/tiff2pdf.c: avoid potential invalid memory read in - t2p_writeproc. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2639 - ---- - ChangeLog | 6 ++++++ - tools/tiff2pdf.c | 20 +++++++++++--------- - 2 files changed, 17 insertions(+), 9 deletions(-) - -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c -index 78ffa77d123a..5348f1a765fe 100644 ---- a/tools/tiff2pdf.c -+++ b/tools/tiff2pdf.c -@@ -2896,6 +2896,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_ - } - if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0) { - if (count >= 4) { -+ int retTIFFReadRawTile; - /* Ignore EOI marker of JpegTables */ - _TIFFmemcpy(buffer, jpt, count - 2); - bufferoffset += count - 2; -@@ -2903,22 +2904,23 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_ - table_end[0] = buffer[bufferoffset-2]; - table_end[1] = buffer[bufferoffset-1]; - xuint32 = bufferoffset; -- bufferoffset -= 2; -- bufferoffset += TIFFReadRawTile( -+ bufferoffset -= 2; -+ retTIFFReadRawTile= TIFFReadRawTile( - input, - tile, - (tdata_t) &(((unsigned char*)buffer)[bufferoffset]), - -1); -+ if( retTIFFReadRawTile < 0 ) -+ { -+ _TIFFfree(buffer); -+ t2p->t2p_error = T2P_ERR_ERROR; -+ return(0); -+ } -+ bufferoffset += retTIFFReadRawTile; - /* Overwrite SOI marker of image scan with previously */ - /* saved end of JpegTables */ - buffer[xuint32-2]=table_end[0]; - buffer[xuint32-1]=table_end[1]; -- } else { -- bufferoffset += TIFFReadRawTile( -- input, -- tile, -- (tdata_t) &(((unsigned char*)buffer)[bufferoffset]), -- -1); - } - } - t2pWriteFile(output, (tdata_t) buffer, bufferoffset); --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2640.patch b/media-libs/tiff/files/tiff-4.0.7-bug2640.patch deleted file mode 100644 index 2569f47a54b0..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2640.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 548b62fae49637b621766c721884d59a55c9a2d8 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Tue, 20 Dec 2016 17:28:17 +0000 -Subject: [PATCH] * tools/tiff2pdf.c: avoid potential heap-based overflow in - t2p_readwrite_pdf_image_tile(). Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2640 - ---- - ChangeLog | 6 ++++++ - tools/tiff2pdf.c | 4 ++-- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c -index 5348f1a765fe..8e4e24ef9e82 100644 ---- a/tools/tiff2pdf.c -+++ b/tools/tiff2pdf.c -@@ -2895,7 +2895,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_ - return(0); - } - if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0) { -- if (count >= 4) { -+ if (count > 4) { - int retTIFFReadRawTile; - /* Ignore EOI marker of JpegTables */ - _TIFFmemcpy(buffer, jpt, count - 2); --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2642-bug2643-bug2646-bug2647.patch b/media-libs/tiff/files/tiff-4.0.7-bug2642-bug2643-bug2646-bug2647.patch deleted file mode 100644 index 6f01774b9d53..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2642-bug2643-bug2646-bug2647.patch +++ /dev/null @@ -1,278 +0,0 @@ -From f049eba476a1ed60adc6534452ccf0022c2d1908 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 16:09:02 +0000 -Subject: [PATCH] * libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement - various clampings of double to other data types to avoid undefined behaviour - if the output range isn't big enough to hold the input value. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2643 - http://bugzilla.maptools.org/show_bug.cgi?id=2642 - http://bugzilla.maptools.org/show_bug.cgi?id=2646 - http://bugzilla.maptools.org/show_bug.cgi?id=2647 - ---- - ChangeLog | 10 ++++++ - libtiff/tif_dir.c | 20 ++++++++--- - libtiff/tif_dirread.c | 12 +++++-- - libtiff/tif_dirwrite.c | 92 ++++++++++++++++++++++++++++++++++++++++++++------ - 4 files changed, 116 insertions(+), 18 deletions(-) - -diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c -index 2574e748b3be..36c7ae57641a 100644 ---- a/libtiff/tif_dir.c -+++ b/libtiff/tif_dir.c -@@ -31,6 +31,7 @@ - * (and also some miscellaneous stuff) - */ - #include "tiffiop.h" -+#include <float.h> - - /* - * These are used in the backwards compatibility code... -@@ -154,6 +155,15 @@ bad: - return (0); - } - -+static float TIFFClampDoubleToFloat( double val ) -+{ -+ if( val > FLT_MAX ) -+ return FLT_MAX; -+ if( val < -FLT_MAX ) -+ return -FLT_MAX; -+ return (float)val; -+} -+ - static int - _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap) - { -@@ -312,13 +322,13 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap) - dblval = va_arg(ap, double); - if( dblval < 0 ) - goto badvaluedouble; -- td->td_xresolution = (float) dblval; -+ td->td_xresolution = TIFFClampDoubleToFloat( dblval ); - break; - case TIFFTAG_YRESOLUTION: - dblval = va_arg(ap, double); - if( dblval < 0 ) - goto badvaluedouble; -- td->td_yresolution = (float) dblval; -+ td->td_yresolution = TIFFClampDoubleToFloat( dblval ); - break; - case TIFFTAG_PLANARCONFIG: - v = (uint16) va_arg(ap, uint16_vap); -@@ -327,10 +337,10 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap) - td->td_planarconfig = (uint16) v; - break; - case TIFFTAG_XPOSITION: -- td->td_xposition = (float) va_arg(ap, double); -+ td->td_xposition = TIFFClampDoubleToFloat( va_arg(ap, double) ); - break; - case TIFFTAG_YPOSITION: -- td->td_yposition = (float) va_arg(ap, double); -+ td->td_yposition = TIFFClampDoubleToFloat( va_arg(ap, double) ); - break; - case TIFFTAG_RESOLUTIONUNIT: - v = (uint16) va_arg(ap, uint16_vap); -diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c -index eae3430612d0..f8628fd6d5d2 100644 ---- a/libtiff/tif_dirread.c -+++ b/libtiff/tif_dirread.c -@@ -40,6 +40,7 @@ - */ - - #include "tiffiop.h" -+#include <float.h> - - #define IGNORE 0 /* tag placeholder used below */ - #define FAILED_FII ((uint32) -1) -@@ -2406,7 +2407,14 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt - ma=(double*)origdata; - mb=data; - for (n=0; n<count; n++) -- *mb++=(float)(*ma++); -+ { -+ double val = *ma++; -+ if( val > FLT_MAX ) -+ val = FLT_MAX; -+ else if( val < -FLT_MAX ) -+ val = -FLT_MAX; -+ *mb++=(float)val; -+ } - } - break; - } -diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c -index 055324db078f..f7339685130d 100644 ---- a/libtiff/tif_dirwrite.c -+++ b/libtiff/tif_dirwrite.c -@@ -30,6 +30,7 @@ - * Directory Write Support Routines. - */ - #include "tiffiop.h" -+#include <float.h> - - #ifdef HAVE_IEEEFP - #define TIFFCvtNativeToIEEEFloat(tif, n, fp) -@@ -939,6 +940,69 @@ bad: - return(0); - } - -+static float TIFFClampDoubleToFloat( double val ) -+{ -+ if( val > FLT_MAX ) -+ return FLT_MAX; -+ if( val < -FLT_MAX ) -+ return -FLT_MAX; -+ return (float)val; -+} -+ -+static int8 TIFFClampDoubleToInt8( double val ) -+{ -+ if( val > 127 ) -+ return 127; -+ if( val < -128 || val != val ) -+ return -128; -+ return (int8)val; -+} -+ -+static int16 TIFFClampDoubleToInt16( double val ) -+{ -+ if( val > 32767 ) -+ return 32767; -+ if( val < -32768 || val != val ) -+ return -32768; -+ return (int16)val; -+} -+ -+static int32 TIFFClampDoubleToInt32( double val ) -+{ -+ if( val > 0x7FFFFFFF ) -+ return 0x7FFFFFFF; -+ if( val < -0x7FFFFFFF-1 || val != val ) -+ return -0x7FFFFFFF-1; -+ return (int32)val; -+} -+ -+static uint8 TIFFClampDoubleToUInt8( double val ) -+{ -+ if( val < 0 ) -+ return 0; -+ if( val > 255 || val != val ) -+ return 255; -+ return (uint8)val; -+} -+ -+static uint16 TIFFClampDoubleToUInt16( double val ) -+{ -+ if( val < 0 ) -+ return 0; -+ if( val > 65535 || val != val ) -+ return 65535; -+ return (uint16)val; -+} -+ -+static uint32 TIFFClampDoubleToUInt32( double val ) -+{ -+ if( val < 0 ) -+ return 0; -+ if( val > 0xFFFFFFFFU || val != val ) -+ return 0xFFFFFFFFU; -+ return (uint32)val; -+} -+ - static int - TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value) - { -@@ -959,7 +1023,7 @@ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di - if (tif->tif_dir.td_bitspersample<=32) - { - for (i = 0; i < count; ++i) -- ((float*)conv)[i] = (float)value[i]; -+ ((float*)conv)[i] = TIFFClampDoubleToFloat(value[i]); - ok = TIFFWriteDirectoryTagFloatArray(tif,ndir,dir,tag,count,(float*)conv); - } - else -@@ -971,19 +1035,19 @@ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di - if (tif->tif_dir.td_bitspersample<=8) - { - for (i = 0; i < count; ++i) -- ((int8*)conv)[i] = (int8)value[i]; -+ ((int8*)conv)[i] = TIFFClampDoubleToInt8(value[i]); - ok = TIFFWriteDirectoryTagSbyteArray(tif,ndir,dir,tag,count,(int8*)conv); - } - else if (tif->tif_dir.td_bitspersample<=16) - { - for (i = 0; i < count; ++i) -- ((int16*)conv)[i] = (int16)value[i]; -+ ((int16*)conv)[i] = TIFFClampDoubleToInt16(value[i]); - ok = TIFFWriteDirectoryTagSshortArray(tif,ndir,dir,tag,count,(int16*)conv); - } - else - { - for (i = 0; i < count; ++i) -- ((int32*)conv)[i] = (int32)value[i]; -+ ((int32*)conv)[i] = TIFFClampDoubleToInt32(value[i]); - ok = TIFFWriteDirectoryTagSlongArray(tif,ndir,dir,tag,count,(int32*)conv); - } - break; -@@ -991,19 +1055,19 @@ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di - if (tif->tif_dir.td_bitspersample<=8) - { - for (i = 0; i < count; ++i) -- ((uint8*)conv)[i] = (uint8)value[i]; -+ ((uint8*)conv)[i] = TIFFClampDoubleToUInt8(value[i]); - ok = TIFFWriteDirectoryTagByteArray(tif,ndir,dir,tag,count,(uint8*)conv); - } - else if (tif->tif_dir.td_bitspersample<=16) - { - for (i = 0; i < count; ++i) -- ((uint16*)conv)[i] = (uint16)value[i]; -+ ((uint16*)conv)[i] = TIFFClampDoubleToUInt16(value[i]); - ok = TIFFWriteDirectoryTagShortArray(tif,ndir,dir,tag,count,(uint16*)conv); - } - else - { - for (i = 0; i < count; ++i) -- ((uint32*)conv)[i] = (uint32)value[i]; -+ ((uint32*)conv)[i] = TIFFClampDoubleToUInt32(value[i]); - ok = TIFFWriteDirectoryTagLongArray(tif,ndir,dir,tag,count,(uint32*)conv); - } - break; -@@ -2102,12 +2166,17 @@ TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, - TIFFErrorExt(tif->tif_clientdata,module,"Negative value is illegal"); - return 0; - } -+ else if( value != value ) -+ { -+ TIFFErrorExt(tif->tif_clientdata,module,"Not-a-number value is illegal"); -+ return 0; -+ } - else if (value==0.0) - { - m[0]=0; - m[1]=1; - } -- else if (value==(double)(uint32)value) -+ else if (value <= 0xFFFFFFFFU && value==(double)(uint32)value) - { - m[0]=(uint32)value; - m[1]=1; -@@ -2148,12 +2217,13 @@ TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* - } - for (na=value, nb=m, nc=0; nc<count; na++, nb+=2, nc++) - { -- if (*na<=0.0) -+ if (*na<=0.0 || *na != *na) - { - nb[0]=0; - nb[1]=1; - } -- else if (*na==(float)(uint32)(*na)) -+ else if (*na >= 0 && *na <= (float)0xFFFFFFFFU && -+ *na==(float)(uint32)(*na)) - { - nb[0]=(uint32)(*na); - nb[1]=1; --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2644.patch b/media-libs/tiff/files/tiff-4.0.7-bug2644.patch deleted file mode 100644 index b4ec01a32177..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2644.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 699097af4e22e48fc78ae7ae02807ec37f0d31fe Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 13:28:01 +0000 -Subject: [PATCH] * libtiff/tif_dirread.c: avoid division by floating point 0 - in TIFFReadDirEntryCheckedRational() and TIFFReadDirEntryCheckedSrational(), - and return 0 in that case (instead of infinity as before presumably) - Apparently some sanitizers do not like those divisions by zero. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2644 - ---- - ChangeLog | 8 ++++++++ - libtiff/tif_dirread.c | 12 +++++++++--- - 2 files changed, 17 insertions(+), 3 deletions(-) - -diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c -index f2905286c0d0..eae3430612d0 100644 ---- a/libtiff/tif_dirread.c -+++ b/libtiff/tif_dirread.c -@@ -2872,7 +2872,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedRational(TIFF* tif, TIFFD - m.l = direntry->tdir_offset.toff_long8; - if (tif->tif_flags&TIFF_SWAB) - TIFFSwabArrayOfLong(m.i,2); -- if (m.i[0]==0) -+ /* Not completely sure what we should do when m.i[1]==0, but some */ -+ /* sanitizers do not like division by 0.0: */ -+ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */ -+ if (m.i[0]==0 || m.i[1]==0) - *value=0.0; - else - *value=(double)m.i[0]/(double)m.i[1]; -@@ -2900,7 +2903,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSrational(TIFF* tif, TIFF - m.l=direntry->tdir_offset.toff_long8; - if (tif->tif_flags&TIFF_SWAB) - TIFFSwabArrayOfLong(m.i,2); -- if ((int32)m.i[0]==0) -+ /* Not completely sure what we should do when m.i[1]==0, but some */ -+ /* sanitizers do not like division by 0.0: */ -+ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */ -+ if ((int32)m.i[0]==0 || m.i[1]==0) - *value=0.0; - else - *value=(double)((int32)m.i[0])/(double)m.i[1]; --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2648.patch b/media-libs/tiff/files/tiff-4.0.7-bug2648.patch deleted file mode 100644 index a3e2f59dc275..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2648.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 569ffefa61f3237fa2221730621c869216c465a6 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 16:13:50 +0000 -Subject: [PATCH] * libtiff/tif_jpeg.c: validate BitsPerSample in - JPEGSetupEncode() to avoid undefined behaviour caused by invalid shift - exponent. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2648 - ---- - ChangeLog | 6 ++++++ - libtiff/tif_jpeg.c | 9 ++++++++- - 2 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c -index 09ef4949f9ee..e45e2a4e17f8 100644 ---- a/libtiff/tif_jpeg.c -+++ b/libtiff/tif_jpeg.c -@@ -1632,6 +1632,13 @@ JPEGSetupEncode(TIFF* tif) - "Invalig horizontal/vertical sampling value"); - return (0); - } -+ if( td->td_bitspersample > 16 ) -+ { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "BitsPerSample %d not allowed for JPEG", -+ td->td_bitspersample); -+ return (0); -+ } - - /* - * A ReferenceBlackWhite field *must* be present since the --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2650-2.patch b/media-libs/tiff/files/tiff-4.0.7-bug2650-2.patch deleted file mode 100644 index eba5b8f50bac..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2650-2.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 08e5d199b0a1c80fc81a1cc718e5d9d019517e37 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 17:48:11 +0000 -Subject: [PATCH] Initialize variable to fix MSVC warning (caused by previous - commit) - ---- - libtiff/tif_read.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c -index 8c5af6a8f5f7..b2edb029a90c 100644 ---- a/libtiff/tif_read.c -+++ b/libtiff/tif_read.c -@@ -420,7 +420,7 @@ TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size, - return ((tmsize_t)(-1)); - } - } else { -- tmsize_t ma; -+ tmsize_t ma = 0; - tmsize_t n; - if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)|| - ((ma=(tmsize_t)td->td_stripoffset[strip])>tif->tif_size)) --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2650.patch b/media-libs/tiff/files/tiff-4.0.7-bug2650.patch deleted file mode 100644 index 2aac26987d51..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2650.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 5368b55d0f88a34ede3d21782d3142b2e11e6eb9 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 16:33:34 +0000 -Subject: [PATCH] * libtiff/tif_read.c: avoid potential undefined behaviour on - signed integer addition in TIFFReadRawStrip1() in isMapped() case. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2650 - ---- - ChangeLog | 6 ++++++ - libtiff/tif_read.c | 29 +++++++++++++++++++---------- - 2 files changed, 25 insertions(+), 10 deletions(-) - -diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c -index 29a311db0cb7..8c5af6a8f5f7 100644 ---- a/libtiff/tif_read.c -+++ b/libtiff/tif_read.c -@@ -420,16 +420,25 @@ TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size, - return ((tmsize_t)(-1)); - } - } else { -- tmsize_t ma,mb; -+ tmsize_t ma; - tmsize_t n; -- ma=(tmsize_t)td->td_stripoffset[strip]; -- mb=ma+size; -- if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)||(ma>tif->tif_size)) -- n=0; -- else if ((mb<ma)||(mb<size)||(mb>tif->tif_size)) -- n=tif->tif_size-ma; -- else -- n=size; -+ if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)|| -+ ((ma=(tmsize_t)td->td_stripoffset[strip])>tif->tif_size)) -+ { -+ n=0; -+ } -+ else if( ma > TIFF_TMSIZE_T_MAX - size ) -+ { -+ n=0; -+ } -+ else -+ { -+ tmsize_t mb=ma+size; -+ if (mb>tif->tif_size) -+ n=tif->tif_size-ma; -+ else -+ n=size; -+ } - if (n!=size) { - #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) - TIFFErrorExt(tif->tif_clientdata, module, --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2651.patch b/media-libs/tiff/files/tiff-4.0.7-bug2651.patch deleted file mode 100644 index 1b800189c594..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2651.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 669faf71833c4c2e72774b2e732ca4d28b149c83 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 19:02:49 +0000 -Subject: [PATCH] * libtiff/tiffiop.h, tif_unix.c, tif_win32.c, tif_vms.c: add - _TIFFcalloc() - -* libtiff/tif_read.c: TIFFReadBufferSetup(): use _TIFFcalloc() to zero -initialize tif_rawdata. -Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2651 ---- - ChangeLog | 8 ++++++++ - libtiff/tif_read.c | 6 ++++-- - libtiff/tif_unix.c | 10 +++++++++- - libtiff/tif_vms.c | 10 +++++++++- - libtiff/tif_win32.c | 10 +++++++++- - libtiff/tiffio.h | 3 ++- - 6 files changed, 41 insertions(+), 6 deletions(-) - -diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c -index b2edb029a90c..6a8c7daf3dfa 100644 ---- a/libtiff/tif_read.c -+++ b/libtiff/tif_read.c -@@ -985,7 +985,9 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size) - "Invalid buffer size"); - return (0); - } -- tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize); -+ /* Initialize to zero to avoid uninitialized buffers in case of */ -+ /* short reads (http://bugzilla.maptools.org/show_bug.cgi?id=2651) */ -+ tif->tif_rawdata = (uint8*) _TIFFcalloc(1, tif->tif_rawdatasize); - tif->tif_flags |= TIFF_MYBUFFER; - } - if (tif->tif_rawdata == NULL) { -diff --git a/libtiff/tif_unix.c b/libtiff/tif_unix.c -index 81e9d6653c2a..80c437cfa37a 100644 ---- a/libtiff/tif_unix.c -+++ b/libtiff/tif_unix.c -@@ -316,6 +316,14 @@ _TIFFmalloc(tmsize_t s) - return (malloc((size_t) s)); - } - -+void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz) -+{ -+ if( nmemb == 0 || siz == 0 ) -+ return ((void *) NULL); -+ -+ return calloc((size_t) nmemb, (size_t)siz); -+} -+ - void - _TIFFfree(void* p) - { -diff --git a/libtiff/tif_win32.c b/libtiff/tif_win32.c -index 24b824f1bd56..090baed87135 100644 ---- a/libtiff/tif_win32.c -+++ b/libtiff/tif_win32.c -@@ -360,6 +360,14 @@ _TIFFmalloc(tmsize_t s) - return (malloc((size_t) s)); - } - -+void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz) -+{ -+ if( nmemb == 0 || siz == 0 ) -+ return ((void *) NULL); -+ -+ return calloc((size_t) nmemb, (size_t)siz); -+} -+ - void - _TIFFfree(void* p) - { -diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h -index 6e508181dbce..ef61b5c06a03 100644 ---- a/libtiff/tiffio.h -+++ b/libtiff/tiffio.h -@@ -293,6 +293,7 @@ extern TIFFCodec* TIFFGetConfiguredCODECs(void); - */ - - extern void* _TIFFmalloc(tmsize_t s); -+extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz); - extern void* _TIFFrealloc(void* p, tmsize_t s); - extern void _TIFFmemset(void* p, int v, tmsize_t c); - extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c); --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2653.patch b/media-libs/tiff/files/tiff-4.0.7-bug2653.patch deleted file mode 100644 index b65a94daeac2..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2653.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 5083c41f3a6824f392adf3a6dce1548afded4211 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 12:15:01 +0000 -Subject: [PATCH] * libtiff/tif_jpeg.c: avoid integer division by zero in - JPEGSetupEncode() when horizontal or vertical sampling is set to 0. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2653 - ---- - ChangeLog | 6 ++++++ - libtiff/tif_jpeg.c | 9 ++++++++- - 2 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c -index dc4364c821a4..09ef4949f9ee 100644 ---- a/libtiff/tif_jpeg.c -+++ b/libtiff/tif_jpeg.c -@@ -1626,6 +1626,13 @@ JPEGSetupEncode(TIFF* tif) - case PHOTOMETRIC_YCBCR: - sp->h_sampling = td->td_ycbcrsubsampling[0]; - sp->v_sampling = td->td_ycbcrsubsampling[1]; -+ if( sp->h_sampling == 0 || sp->v_sampling == 0 ) -+ { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Invalig horizontal/vertical sampling value"); -+ return (0); -+ } -+ - /* - * A ReferenceBlackWhite field *must* be present since the - * default value is inappropriate for YCbCr. Fill in the --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2658.patch b/media-libs/tiff/files/tiff-4.0.7-bug2658.patch deleted file mode 100644 index 9f2bb6a50ee2..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2658.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 928f0b0b2881ac32b32d9e165e88e3c9aed0fb9c Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Wed, 11 Jan 2017 16:38:26 +0000 -Subject: [PATCH] =?UTF-8?q?*=20libtiff/tif=5Fgetimage.c:=20add=20explicit?= - =?UTF-8?q?=20uint32=20cast=20in=20putagreytile=20to=20avoid=20UndefinedBe?= - =?UTF-8?q?haviorSanitizer=20warning.=20Patch=20by=20Nicol=C3=A1s=20Pe?= - =?UTF-8?q?=C3=B1a.=20Fixes=20http://bugzilla.maptools.org/show=5Fbug.cgi?= - =?UTF-8?q?=3Fid=3D2658?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - ChangeLog | 7 +++++++ - libtiff/tif_getimage.c | 4 ++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c -index 2ea838556732..52a2402f7171 100644 ---- a/libtiff/tif_getimage.c -+++ b/libtiff/tif_getimage.c -@@ -1302,7 +1302,7 @@ DECLAREContigPutFunc(putagreytile) - while (h-- > 0) { - for (x = w; x-- > 0;) - { -- *cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1); -+ *cp++ = BWmap[*pp][0] & ((uint32)*(pp+1) << 24 | ~A1); - pp += samplesperpixel; - } - cp += toskew; --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2659-2.patch b/media-libs/tiff/files/tiff-4.0.7-bug2659-2.patch deleted file mode 100644 index 539536fe4ffb..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2659-2.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 41236c5f744eaa691e23e55f5a5dd556a65e211e Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Thu, 12 Jan 2017 19:23:20 +0000 -Subject: [PATCH] * libtiff/tif_ojpeg.c: fix leak in - OJPEGReadHeaderInfoSecTablesQTable, OJPEGReadHeaderInfoSecTablesDcTable and - OJPEGReadHeaderInfoSecTablesAcTable - ---- - ChangeLog | 3 ++- - libtiff/tif_ojpeg.c | 8 +++++++- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c -index ac70d1b14c4f..bd4cff5d8921 100644 ---- a/libtiff/tif_ojpeg.c -+++ b/libtiff/tif_ojpeg.c -@@ -1790,7 +1790,10 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif) - TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); - p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64); - if (p!=64) -+ { -+ _TIFFfree(ob); - return(0); -+ } - sp->qtable[m]=ob; - sp->sof_tq[m]=m; - } -@@ -1854,7 +1857,10 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif) - rb[sizeof(uint32)+5+n]=o[n]; - p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q); - if (p!=q) -+ { -+ _TIFFfree(rb); - return(0); -+ } - sp->dctable[m]=rb; - sp->sos_tda[m]=(m<<4); - } --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2659.patch b/media-libs/tiff/files/tiff-4.0.7-bug2659.patch deleted file mode 100644 index 8afab46b888f..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2659.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 7c501dbfb5315f31798f9123026210260cbe7432 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Thu, 12 Jan 2017 17:43:25 +0000 -Subject: [PATCH] =?UTF-8?q?*=20libtiff/tif=5Fojpeg.c:=20fix=20leak=20in=20?= - =?UTF-8?q?OJPEGReadHeaderInfoSecTablesAcTable=20when=20read=20fails.=20Pa?= - =?UTF-8?q?tch=20by=20Nicol=C3=A1s=20Pe=C3=B1a.=20Fixes=20http://bugzilla.?= - =?UTF-8?q?maptools.org/show=5Fbug.cgi=3Fid=3D2659?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - ChangeLog | 7 +++++++ - libtiff/tif_ojpeg.c | 5 ++++- - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c -index 93839d8f3e11..ac70d1b14c4f 100644 ---- a/libtiff/tif_ojpeg.c -+++ b/libtiff/tif_ojpeg.c -@@ -1918,7 +1918,10 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif) - rb[sizeof(uint32)+5+n]=o[n]; - p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q); - if (p!=q) -+ { -+ _TIFFfree(rb); - return(0); -+ } - sp->actable[m]=rb; - sp->sos_tda[m]=(sp->sos_tda[m]|m); - } --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2665.patch b/media-libs/tiff/files/tiff-4.0.7-bug2665.patch deleted file mode 100644 index 020adca8e7aa..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-bug2665.patch +++ /dev/null @@ -1,43 +0,0 @@ -From e345ce2ad81c85eb8e469b7b959067b2681957ca Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Sat, 18 Feb 2017 20:30:26 +0000 -Subject: [PATCH] =?UTF-8?q?*=20libtiff/tif=5Fpixarlog.c:=20fix=20memory=20?= - =?UTF-8?q?leak=20in=20error=20code=20path=20of=20PixarLogSetupDecode().?= - =?UTF-8?q?=20Patch=20by=20Nicol=C3=A1s=20Pe=C3=B1a.=20Fixes=20http://bugz?= - =?UTF-8?q?illa.maptools.org/show=5Fbug.cgi=3Fid=3D2665?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - ChangeLog | 6 ++++++ - libtiff/tif_pixarlog.c | 8 +++++++- - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c -index 9836dce63450..972ee75e0324 100644 ---- a/libtiff/tif_pixarlog.c -+++ b/libtiff/tif_pixarlog.c -@@ -699,6 +699,9 @@ PixarLogSetupDecode(TIFF* tif) - if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) - sp->user_datafmt = PixarLogGuessDataFmt(td); - if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) { -+ _TIFFfree(sp->tbuf); -+ sp->tbuf = NULL; -+ sp->tbuf_size = 0; - TIFFErrorExt(tif->tif_clientdata, module, - "PixarLog compression can't handle bits depth/data format combination (depth: %d)", - td->td_bitspersample); -@@ -706,6 +709,9 @@ PixarLogSetupDecode(TIFF* tif) - } - - if (inflateInit(&sp->stream) != Z_OK) { -+ _TIFFfree(sp->tbuf); -+ sp->tbuf = NULL; -+ sp->tbuf_size = 0; - TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)"); - return (0); - } else { --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-fax2tiff.patch b/media-libs/tiff/files/tiff-4.0.7-fax2tiff.patch deleted file mode 100644 index f3476e98d6ff..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-fax2tiff.patch +++ /dev/null @@ -1,39 +0,0 @@ -https://bugs.gentoo.org/598938 - -From 82c53c6f19d8d7854b9b88aa16802f31b1cc258c Mon Sep 17 00:00:00 2001 -From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us> -Date: Sun, 20 Nov 2016 18:04:52 +0000 -Subject: [PATCH] =?UTF-8?q?*=20tools/fax2tiff.c=20(main):=20Applied=20patc?= - =?UTF-8?q?h=20by=20J=C3=B6rg=20Ahrens=20to=20fix=20passing=20client=20dat?= - =?UTF-8?q?a=20for=20Win32=20builds=20using=20tif=5Fwin32.c=20(USE=5FWIN32?= - =?UTF-8?q?=5FFILEIO=20defined)=20for=20file=20I/O.=20=20Patch=20was=20pro?= - =?UTF-8?q?vided=20via=20email=20on=20November=2020,=202016.?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - ChangeLog | 7 +++++++ - tools/fax2tiff.c | 5 +++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c -index e00de5277bc2..01f85540ac9c 100644 ---- a/tools/fax2tiff.c -+++ b/tools/fax2tiff.c -@@ -283,10 +283,11 @@ main(int argc, char* argv[]) - } - #if defined(_WIN32) && defined(USE_WIN32_FILEIO) - client_data.fh = _get_osfhandle(fileno(in)); -+ TIFFSetClientdata(faxTIFF, (thandle_t) client_data.fh); - #else - client_data.fd = fileno(in); -+ TIFFSetClientdata(faxTIFF, (thandle_t) client_data.fd); - #endif -- TIFFSetClientdata(faxTIFF, (thandle_t) &client_data); - TIFFSetFileName(faxTIFF, (const char*)argv[optind]); - TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize); - TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1); --- -2.12.0 - diff --git a/media-libs/tiff/files/tiff-4.0.7-hylafax-hack.patch b/media-libs/tiff/files/tiff-4.0.7-hylafax-hack.patch deleted file mode 100644 index 69158200ac73..000000000000 --- a/media-libs/tiff/files/tiff-4.0.7-hylafax-hack.patch +++ /dev/null @@ -1,38 +0,0 @@ -https://bugs.gentoo.org/612172 - -From 96bb01f5d834e0b01c0231768c43b8d309aede34 Mon Sep 17 00:00:00 2001 -From: Even Rouault <even.rouault@spatialys.com> -Date: Tue, 13 Dec 2016 18:15:48 +0000 -Subject: [PATCH] * libtiff/tif_fax3.h: revert change done on 2016-01-09 that - made Param member of TIFFFaxTabEnt structure a uint16 to reduce size of the - binary. It happens that the Hylafax software uses the tables that follow this - typedef (TIFFFaxMainTable, TIFFFaxWhiteTable, TIFFFaxBlackTable), also they - are not in a public libtiff header. Raised by Lee Howard. Fixes - http://bugzilla.maptools.org/show_bug.cgi?id=2636 - ---- - ChangeLog | 10 ++++++++++ - libtiff/tif_fax3.h | 6 ++++-- - 2 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/libtiff/tif_fax3.h b/libtiff/tif_fax3.h -index e0b2ca6bfc9d..45ce43f1cf2e 100644 ---- a/libtiff/tif_fax3.h -+++ b/libtiff/tif_fax3.h -@@ -81,10 +81,12 @@ extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32); - #define S_MakeUp 11 - #define S_EOL 12 - -+/* WARNING: do not change the layout of this structure as the Halyfax software */ -+/* really depends on it. See http://bugzilla.maptools.org/show_bug.cgi?id=2636 */ - typedef struct { /* state table entry */ - unsigned char State; /* see above */ - unsigned char Width; /* width of code in bits */ -- uint16 Param; /* unsigned 16-bit run length in bits */ -+ uint32 Param; /* unsigned 32-bit run length in bits (holds on 16 bit actually, but cannot be changed. See above warning) */ - } TIFFFaxTabEnt; - - extern const TIFFFaxTabEnt TIFFFaxMainTable[]; --- -2.12.0 - diff --git a/media-libs/tiff/tiff-4.0.7-r3.ebuild b/media-libs/tiff/tiff-4.0.7-r3.ebuild deleted file mode 100644 index b77d5196171d..000000000000 --- a/media-libs/tiff/tiff-4.0.7-r3.ebuild +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" -inherit autotools eutils libtool multilib-minimal - -DESCRIPTION="Tag Image File Format (TIFF) library" -HOMEPAGE="http://libtiff.maptools.org" -SRC_URI="http://download.osgeo.org/libtiff/${P}.tar.gz - ftp://ftp.remotesensing.org/pub/libtiff/${P}.tar.gz" - -LICENSE="libtiff" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris" -IUSE="+cxx jbig jpeg lzma static-libs test zlib" - -RDEPEND="jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) - jbig? ( >=media-libs/jbigkit-2.1:=[${MULTILIB_USEDEP}] ) - lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] ) - zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] ) - abi_x86_32? ( - !<=app-emulation/emul-linux-x86-baselibs-20130224-r9 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] - )" -DEPEND="${RDEPEND}" - -REQUIRED_USE="test? ( jpeg )" #483132 - -PATCHES=( - "${FILESDIR}"/${P}-fax2tiff.patch #598938 - "${FILESDIR}"/${P}-CVE-2016-10266.patch - "${FILESDIR}"/${P}-bug2598.patch - "${FILESDIR}"/${P}-bug2604.patch - "${FILESDIR}"/${P}-bug2608.patch - "${FILESDIR}"/${P}-CVE-2016-10267.patch - "${FILESDIR}"/${P}-bug2620.patch - "${FILESDIR}"/${P}-bug2621.patch - "${FILESDIR}"/${P}-bug2619.patch - "${FILESDIR}"/${P}-bug2594.patch - "${FILESDIR}"/${P}-bug2597.patch - "${FILESDIR}"/${P}-bug2599.patch - "${FILESDIR}"/${P}-bug2607.patch - "${FILESDIR}"/${P}-bug2610.patch - "${FILESDIR}"/${P}-bug2605.patch - "${FILESDIR}"/${P}-hylafax-hack.patch #612172 - "${FILESDIR}"/${P}-bug2633-bug2634.patch - "${FILESDIR}"/${P}-bug2635.patch - "${FILESDIR}"/${P}-bug2627.patch - "${FILESDIR}"/${P}-bug2638.patch - "${FILESDIR}"/${P}-bug2639.patch - "${FILESDIR}"/${P}-bug2640.patch - "${FILESDIR}"/${P}-bug2653.patch - "${FILESDIR}"/${P}-bug2535.patch - "${FILESDIR}"/${P}-bug2644.patch - "${FILESDIR}"/${P}-bug2642-bug2643-bug2646-bug2647.patch - "${FILESDIR}"/${P}-bug2648.patch - "${FILESDIR}"/${P}-bug2650.patch - "${FILESDIR}"/${P}-bug2658.patch - "${FILESDIR}"/${P}-bug2650-2.patch - "${FILESDIR}"/${P}-bug2651.patch - "${FILESDIR}"/${P}-CVE-2017-5225.patch #610330 - "${FILESDIR}"/${P}-bug2130.patch - "${FILESDIR}"/${P}-bug2659.patch - "${FILESDIR}"/${P}-bug2659-2.patch - "${FILESDIR}"/${P}-bug2631.patch - "${FILESDIR}"/${P}-bug2665.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0005-Leak-TIFFFetchStripThing.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0007-uninitialized-value.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0008-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0013-validate-refblackwhite.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0017-safe_skews_in_gtTileContig.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0018-fix-leak-in-PredictorSetupDecode.patch - "${FILESDIR}"/${PN}-4.0.7-pdfium-0021-oom-TIFFFillStrip.patch -) - -MULTILIB_WRAPPED_HEADERS=( - /usr/include/tiffconf.h -) - -src_prepare() { - default - - # tiffcp-thumbnail.sh fails as thumbnail binary doesn't get built anymore since tiff-4.0.7 - sed '/tiffcp-thumbnail\.sh/d' -i test/Makefile.am || die - - eautoreconf -} - -multilib_src_configure() { - ECONF_SOURCE="${S}" econf \ - $(use_enable static-libs static) \ - $(use_enable zlib) \ - $(use_enable jpeg) \ - $(use_enable jbig) \ - $(use_enable lzma) \ - $(use_enable cxx) \ - --without-x - - # remove useless subdirs - if ! multilib_is_native_abi ; then - sed -i \ - -e 's/ tools//' \ - -e 's/ contrib//' \ - -e 's/ man//' \ - -e 's/ html//' \ - Makefile || die - fi -} - -multilib_src_test() { - if ! multilib_is_native_abi ; then - emake -C tools - fi - emake check -} - -multilib_src_install_all() { - prune_libtool_files --all - rm -f "${ED}"/usr/share/doc/${PF}/{COPYRIGHT,README*,RELEASE-DATE,TODO,VERSION} -} diff --git a/media-libs/tiff/tiff-4.0.7.ebuild b/media-libs/tiff/tiff-4.0.7.ebuild deleted file mode 100644 index 59be2b40a56c..000000000000 --- a/media-libs/tiff/tiff-4.0.7.ebuild +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 -inherit autotools eutils libtool multilib-minimal - -DESCRIPTION="Tag Image File Format (TIFF) library" -HOMEPAGE="http://libtiff.maptools.org" -SRC_URI="http://download.osgeo.org/libtiff/${P}.tar.gz - ftp://ftp.remotesensing.org/pub/libtiff/${P}.tar.gz" - -LICENSE="libtiff" -SLOT="0" -KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris" -IUSE="+cxx jbig jpeg lzma static-libs test zlib" - -RDEPEND="jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) - jbig? ( >=media-libs/jbigkit-2.1:=[${MULTILIB_USEDEP}] ) - lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] ) - zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] ) - abi_x86_32? ( - !<=app-emulation/emul-linux-x86-baselibs-20130224-r9 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] - )" -DEPEND="${RDEPEND}" - -REQUIRED_USE="test? ( jpeg )" #483132 - -MULTILIB_WRAPPED_HEADERS=( - /usr/include/tiffconf.h -) - -src_prepare() { - default - - # tiffcp-thumbnail.sh fails as thumbnail binary doesn't get built anymore since tiff-4.0.7 - sed '/tiffcp-thumbnail\.sh/d' -i test/Makefile.am || die - - eautoreconf -} - -multilib_src_configure() { - ECONF_SOURCE="${S}" econf \ - $(use_enable static-libs static) \ - $(use_enable zlib) \ - $(use_enable jpeg) \ - $(use_enable jbig) \ - $(use_enable lzma) \ - $(use_enable cxx) \ - --without-x - - # remove useless subdirs - if ! multilib_is_native_abi ; then - sed -i \ - -e 's/ tools//' \ - -e 's/ contrib//' \ - -e 's/ man//' \ - -e 's/ html//' \ - Makefile || die - fi -} - -multilib_src_test() { - if ! multilib_is_native_abi ; then - emake -C tools - fi - emake check -} - -multilib_src_install_all() { - prune_libtool_files --all - rm -f "${ED}"/usr/share/doc/${PF}/{COPYRIGHT,README*,RELEASE-DATE,TODO,VERSION} -} |