diff --git a/baselibs.conf b/baselibs.conf index 676cb56..6b0fc0c 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,6 +1,6 @@ -libtiff5 +libtiff6 obsoletes "libtiff- <= " provides "libtiff- = " libtiff-devel requires -libtiff- - requires "libtiff5- = " + requires "libtiff6- = " diff --git a/tiff-4.0.3-compress-warning.patch b/tiff-4.0.3-compress-warning.patch index dae54b7..abfa3f4 100644 --- a/tiff-4.0.3-compress-warning.patch +++ b/tiff-4.0.3-compress-warning.patch @@ -1,11 +1,9 @@ -Index: tiff-4.0.3/tools/tiff2pdf.c -=================================================================== ---- tiff-4.0.3.orig/tools/tiff2pdf.c -+++ tiff-4.0.3/tools/tiff2pdf.c -@@ -1264,6 +1264,15 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* - return; - - } +--- tiff-4.5.0/tools/tiff2pdf.c.orig 2023-01-04 09:52:13.665734351 +0100 ++++ tiff-4.5.0/tools/tiff2pdf.c 2023-01-04 09:53:13.922053942 +0100 +@@ -1435,6 +1435,15 @@ + t2p->t2p_error = T2P_ERR_ERROR; + return; + } + if(t2p->tiff_compression != COMPRESSION_LZW && + t2p->tiff_compression != COMPRESSION_NONE){ + TIFFWarning( @@ -15,6 +13,6 @@ Index: tiff-4.0.3/tools/tiff2pdf.c + "Consider to use tiffcp(1) to change compress algorithm first.", + TIFFFileName(input) ); + } - if( TIFFIsCODECConfigured(t2p->tiff_compression) == 0){ - TIFFError( - TIFF2PDF_MODULE, + if (TIFFIsCODECConfigured(t2p->tiff_compression) == 0) + { + TIFFError(TIFF2PDF_MODULE, diff --git a/tiff-4.0.3-seek.patch b/tiff-4.0.3-seek.patch index ac122ed..747afe1 100644 --- a/tiff-4.0.3-seek.patch +++ b/tiff-4.0.3-seek.patch @@ -1,13 +1,11 @@ -Index: tiff-4.0.1/libtiff/tiffiop.h -=================================================================== ---- tiff-4.0.1.orig/libtiff/tiffiop.h -+++ tiff-4.0.1/libtiff/tiffiop.h -@@ -213,7 +213,7 @@ struct tiff { - #define TIFFWriteFile(tif, buf, size) \ - ((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size))) - #define TIFFSeekFile(tif, off, whence) \ -- ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence))) -+ ((tif)->tif_seekproc?((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence)):0) - #define TIFFCloseFile(tif) \ - ((*(tif)->tif_closeproc)((tif)->tif_clientdata)) - #define TIFFGetFileSize(tif) \ +--- tiff-4.5.0/libtiff/tiffiop.h.orig 2023-01-04 09:58:24.947703675 +0100 ++++ tiff-4.5.0/libtiff/tiffiop.h 2023-01-04 09:57:09.507303516 +0100 +@@ -257,7 +257,7 @@ + #define TIFFWriteFile(tif, buf, size) \ + ((*(tif)->tif_writeproc)((tif)->tif_clientdata, (buf), (size))) + #define TIFFSeekFile(tif, off, whence) \ +- ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence))) ++ ((tif)->tif_seekproc?((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence)):0) + #define TIFFCloseFile(tif) ((*(tif)->tif_closeproc)((tif)->tif_clientdata)) + #define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata)) + #define TIFFMapFileContents(tif, paddr, psize) \ diff --git a/tiff-4.4.0.tar.xz b/tiff-4.4.0.tar.xz deleted file mode 100644 index d3cfcd4..0000000 --- a/tiff-4.4.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:49307b510048ccc7bc40f2cba6e8439182fe6e654057c1a1683139bf2ecb1dc1 -size 1929292 diff --git a/tiff-4.4.0.tar.xz.sig b/tiff-4.4.0.tar.xz.sig deleted file mode 100644 index 04e6c70..0000000 Binary files a/tiff-4.4.0.tar.xz.sig and /dev/null differ diff --git a/tiff-4.5.0.tar.xz b/tiff-4.5.0.tar.xz new file mode 100644 index 0000000..ea0003e --- /dev/null +++ b/tiff-4.5.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dafac979c5e7b6c650025569c5a4e720995ba5f17bc17e6276d1f12427be267c +size 2320900 diff --git a/tiff-4.5.0.tar.xz.sig b/tiff-4.5.0.tar.xz.sig new file mode 100644 index 0000000..0b798c7 Binary files /dev/null and b/tiff-4.5.0.tar.xz.sig differ diff --git a/tiff-CVE-2022-2056,CVE-2022-2057,CVE-2022-2058.patch b/tiff-CVE-2022-2056,CVE-2022-2057,CVE-2022-2058.patch deleted file mode 100644 index c552ea5..0000000 --- a/tiff-CVE-2022-2056,CVE-2022-2057,CVE-2022-2058.patch +++ /dev/null @@ -1,178 +0,0 @@ -Index: tiff-4.4.0/libtiff/tif_aux.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_aux.c -+++ tiff-4.4.0/libtiff/tif_aux.c -@@ -402,6 +402,15 @@ float _TIFFClampDoubleToFloat( double va - return (float)val; - } - -+uint32_t _TIFFClampDoubleToUInt32(double val) -+{ -+ if( val < 0 ) -+ return 0; -+ if( val > 0xFFFFFFFFU || val != val ) -+ return 0xFFFFFFFFU; -+ return (uint32_t)val; -+} -+ - int _TIFFSeekOK(TIFF* tif, toff_t off) - { - /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */ -Index: tiff-4.4.0/libtiff/tiffiop.h -=================================================================== ---- tiff-4.4.0.orig/libtiff/tiffiop.h -+++ tiff-4.4.0/libtiff/tiffiop.h -@@ -365,6 +365,7 @@ extern double _TIFFUInt64ToDouble(uint64 - extern float _TIFFUInt64ToFloat(uint64_t); - - extern float _TIFFClampDoubleToFloat(double); -+extern uint32_t _TIFFClampDoubleToUInt32(double); - - extern tmsize_t - _TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip, -Index: tiff-4.4.0/tools/tiffcrop.c -=================================================================== ---- tiff-4.4.0.orig/tools/tiffcrop.c -+++ tiff-4.4.0/tools/tiffcrop.c -@@ -5268,17 +5268,17 @@ computeInputPixelOffsets(struct crop_mas - { - if ((crop->res_unit == RESUNIT_INCH) || (crop->res_unit == RESUNIT_CENTIMETER)) - { -- x1 = (uint32_t) (crop->corners[i].X1 * scale * xres); -- x2 = (uint32_t) (crop->corners[i].X2 * scale * xres); -- y1 = (uint32_t) (crop->corners[i].Y1 * scale * yres); -- y2 = (uint32_t) (crop->corners[i].Y2 * scale * yres); -+ x1 = _TIFFClampDoubleToUInt32(crop->corners[i].X1 * scale * xres); -+ x2 = _TIFFClampDoubleToUInt32(crop->corners[i].X2 * scale * xres); -+ y1 = _TIFFClampDoubleToUInt32(crop->corners[i].Y1 * scale * yres); -+ y2 = _TIFFClampDoubleToUInt32(crop->corners[i].Y2 * scale * yres); - } - else - { -- x1 = (uint32_t) (crop->corners[i].X1); -- x2 = (uint32_t) (crop->corners[i].X2); -- y1 = (uint32_t) (crop->corners[i].Y1); -- y2 = (uint32_t) (crop->corners[i].Y2); -+ x1 = _TIFFClampDoubleToUInt32(crop->corners[i].X1); -+ x2 = _TIFFClampDoubleToUInt32(crop->corners[i].X2); -+ y1 = _TIFFClampDoubleToUInt32(crop->corners[i].Y1); -+ y2 = _TIFFClampDoubleToUInt32(crop->corners[i].Y2); - } - /* a) Region needs to be within image sizes 0.. width-1; 0..length-1 - * b) Corners are expected to be submitted as top-left to bottom-right. -@@ -5357,17 +5357,17 @@ computeInputPixelOffsets(struct crop_mas - { - if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER) - { /* User has specified pixels as reference unit */ -- tmargin = (uint32_t)(crop->margins[0]); -- lmargin = (uint32_t)(crop->margins[1]); -- bmargin = (uint32_t)(crop->margins[2]); -- rmargin = (uint32_t)(crop->margins[3]); -+ tmargin = _TIFFClampDoubleToUInt32(crop->margins[0]); -+ lmargin = _TIFFClampDoubleToUInt32(crop->margins[1]); -+ bmargin = _TIFFClampDoubleToUInt32(crop->margins[2]); -+ rmargin = _TIFFClampDoubleToUInt32(crop->margins[3]); - } - else - { /* inches or centimeters specified */ -- tmargin = (uint32_t)(crop->margins[0] * scale * yres); -- lmargin = (uint32_t)(crop->margins[1] * scale * xres); -- bmargin = (uint32_t)(crop->margins[2] * scale * yres); -- rmargin = (uint32_t)(crop->margins[3] * scale * xres); -+ tmargin = _TIFFClampDoubleToUInt32(crop->margins[0] * scale * yres); -+ lmargin = _TIFFClampDoubleToUInt32(crop->margins[1] * scale * xres); -+ bmargin = _TIFFClampDoubleToUInt32(crop->margins[2] * scale * yres); -+ rmargin = _TIFFClampDoubleToUInt32(crop->margins[3] * scale * xres); - } - - if ((lmargin + rmargin) > image->width) -@@ -5397,24 +5397,24 @@ computeInputPixelOffsets(struct crop_mas - if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER) - { - if (crop->crop_mode & CROP_WIDTH) -- width = (uint32_t)crop->width; -+ width = _TIFFClampDoubleToUInt32(crop->width); - else - width = image->width - lmargin - rmargin; - - if (crop->crop_mode & CROP_LENGTH) -- length = (uint32_t)crop->length; -+ length = _TIFFClampDoubleToUInt32(crop->length); - else - length = image->length - tmargin - bmargin; - } - else - { - if (crop->crop_mode & CROP_WIDTH) -- width = (uint32_t)(crop->width * scale * image->xres); -+ width = _TIFFClampDoubleToUInt32(crop->width * scale * image->xres); - else - width = image->width - lmargin - rmargin; - - if (crop->crop_mode & CROP_LENGTH) -- length = (uint32_t)(crop->length * scale * image->yres); -+ length = _TIFFClampDoubleToUInt32(crop->length * scale * image->yres); - else - length = image->length - tmargin - bmargin; - } -@@ -5868,13 +5868,13 @@ computeOutputPixelOffsets (struct crop_m - { - if (page->res_unit == RESUNIT_INCH || page->res_unit == RESUNIT_CENTIMETER) - { /* inches or centimeters specified */ -- hmargin = (uint32_t)(page->hmargin * scale * page->hres * ((image->bps + 7) / 8)); -- vmargin = (uint32_t)(page->vmargin * scale * page->vres * ((image->bps + 7) / 8)); -+ hmargin = _TIFFClampDoubleToUInt32(page->hmargin * scale * page->hres * ((image->bps + 7) / 8)); -+ vmargin = _TIFFClampDoubleToUInt32(page->vmargin * scale * page->vres * ((image->bps + 7) / 8)); - } - else - { /* Otherwise user has specified pixels as reference unit */ -- hmargin = (uint32_t)(page->hmargin * scale * ((image->bps + 7) / 8)); -- vmargin = (uint32_t)(page->vmargin * scale * ((image->bps + 7) / 8)); -+ hmargin = _TIFFClampDoubleToUInt32(page->hmargin * scale * ((image->bps + 7) / 8)); -+ vmargin = _TIFFClampDoubleToUInt32(page->vmargin * scale * ((image->bps + 7) / 8)); - } - - if ((hmargin * 2.0) > (pwidth * page->hres)) -@@ -5912,13 +5912,13 @@ computeOutputPixelOffsets (struct crop_m - { - if (page->mode & PAGE_MODE_PAPERSIZE ) - { -- owidth = (uint32_t)((pwidth * page->hres) - (hmargin * 2)); -- olength = (uint32_t)((plength * page->vres) - (vmargin * 2)); -+ owidth = _TIFFClampDoubleToUInt32((pwidth * page->hres) - (hmargin * 2)); -+ olength = _TIFFClampDoubleToUInt32((plength * page->vres) - (vmargin * 2)); - } - else - { -- owidth = (uint32_t)(iwidth - (hmargin * 2 * page->hres)); -- olength = (uint32_t)(ilength - (vmargin * 2 * page->vres)); -+ owidth = _TIFFClampDoubleToUInt32(iwidth - (hmargin * 2 * page->hres)); -+ olength = _TIFFClampDoubleToUInt32(ilength - (vmargin * 2 * page->vres)); - } - } - -@@ -5927,6 +5927,12 @@ computeOutputPixelOffsets (struct crop_m - if (olength > ilength) - olength = ilength; - -+ if (owidth == 0 || olength == 0) -+ { -+ TIFFError("computeOutputPixelOffsets", "Integer overflow when calculating the number of pages"); -+ exit(EXIT_FAILURE); -+ } -+ - /* Compute the number of pages required for Portrait or Landscape */ - switch (page->orient) - { -Index: tiff-4.4.0/libtiff/libtiff.def -=================================================================== ---- tiff-4.4.0.orig/libtiff/libtiff.def -+++ tiff-4.4.0/libtiff/libtiff.def -@@ -170,6 +170,7 @@ EXPORTS TIFFAccessTagMethods - TIFFYCbCrtoRGB - _TIFFCheckMalloc - _TIFFCheckRealloc -+ _TIFFClampDoubleToUInt32 - _TIFFRewriteField - _TIFFfree - _TIFFmalloc diff --git a/tiff-CVE-2022-2519,CVE-2022-2520,CVE-2022-2521.patch b/tiff-CVE-2022-2519,CVE-2022-2520,CVE-2022-2521.patch deleted file mode 100644 index e420f2b..0000000 --- a/tiff-CVE-2022-2519,CVE-2022-2520,CVE-2022-2521.patch +++ /dev/null @@ -1,72 +0,0 @@ -Index: tiff-4.4.0/tools/tiffcrop.c -=================================================================== ---- tiff-4.4.0.orig/tools/tiffcrop.c -+++ tiff-4.4.0/tools/tiffcrop.c -@@ -108,7 +108,7 @@ - * lower level, scanline level routines. Debug reports a limited set - * of messages to monitor progress without enabling dump logs. - * -- * Note: The (-X|-Y), -Z and -z options are mutually exclusive. -+ * Note: The (-X|-Y), -Z, -z and -S options are mutually exclusive. - * In no case should the options be applied to a given selection successively. - */ - -@@ -173,12 +173,12 @@ static char tiffcrop_rev_date[] = "02- - #define ROTATECW_270 32 - #define ROTATE_ANY (ROTATECW_90 | ROTATECW_180 | ROTATECW_270) - --#define CROP_NONE 0 --#define CROP_MARGINS 1 --#define CROP_WIDTH 2 --#define CROP_LENGTH 4 --#define CROP_ZONES 8 --#define CROP_REGIONS 16 -+#define CROP_NONE 0 /* "-S" -> Page_MODE_ROWSCOLS and page->rows/->cols != 0 */ -+#define CROP_MARGINS 1 /* "-m" */ -+#define CROP_WIDTH 2 /* "-X" */ -+#define CROP_LENGTH 4 /* "-Y" */ -+#define CROP_ZONES 8 /* "-Z" */ -+#define CROP_REGIONS 16 /* "-z" */ - #define CROP_ROTATE 32 - #define CROP_MIRROR 64 - #define CROP_INVERT 128 -@@ -316,7 +316,7 @@ struct crop_mask { - #define PAGE_MODE_RESOLUTION 1 - #define PAGE_MODE_PAPERSIZE 2 - #define PAGE_MODE_MARGINS 4 --#define PAGE_MODE_ROWSCOLS 8 -+#define PAGE_MODE_ROWSCOLS 8 /* for -S option */ - - #define INVERT_DATA_ONLY 10 - #define INVERT_DATA_AND_TAG 11 -@@ -781,7 +781,7 @@ static const char usage_info[] = - " The four debug/dump options are independent, though it makes little sense to\n" - " specify a dump file without specifying a detail level.\n" - "\n" --"Note: The (-X|-Y), -Z and -z options are mutually exclusive.\n" -+"Note: The (-X|-Y), -Z, -z and -S options are mutually exclusive.\n" - " In no case should the options be applied to a given selection successively.\n" - "\n" - ; -@@ -2131,13 +2131,14 @@ void process_command_opts (int argc, ch - /*NOTREACHED*/ - } - } -- /*-- Check for not allowed combinations (e.g. -X, -Y and -Z and -z are mutually exclusive) --*/ -- char XY, Z, R; -- XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)); -- Z = (crop_data->crop_mode & CROP_ZONES); -- R = (crop_data->crop_mode & CROP_REGIONS); -- if ((XY && Z) || (XY && R) || (Z && R)) { -- TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z and -z are mutually exclusive.->Exit"); -+ /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/ -+ char XY, Z, R, S; -+ XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)) ? 1 : 0; -+ Z = (crop_data->crop_mode & CROP_ZONES) ? 1 : 0; -+ R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0; -+ S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0; -+ if (XY + Z + R + S > 1) { -+ TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit"); - exit(EXIT_FAILURE); - } - } /* end process_command_opts */ diff --git a/tiff-CVE-2022-34526.patch b/tiff-CVE-2022-34526.patch deleted file mode 100644 index c9a359d..0000000 --- a/tiff-CVE-2022-34526.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: tiff-4.4.0/libtiff/tif_dirinfo.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_dirinfo.c -+++ tiff-4.4.0/libtiff/tif_dirinfo.c -@@ -1191,6 +1191,9 @@ _TIFFCheckFieldIsValidForCodec(TIFF *tif - default: - return 1; - } -+ if( !TIFFIsCODECConfigured(tif->tif_dir.td_compression) ) { -+ return 0; -+ } - /* Check if codec specific tags are allowed for the current - * compression scheme (codec) */ - switch (tif->tif_dir.td_compression) { diff --git a/tiff-CVE-2022-3597,CVE-2022-3626,CVE-2022-3627.patch b/tiff-CVE-2022-3597,CVE-2022-3626,CVE-2022-3627.patch deleted file mode 100644 index f3a7411..0000000 --- a/tiff-CVE-2022-3597,CVE-2022-3626,CVE-2022-3627.patch +++ /dev/null @@ -1,66 +0,0 @@ -Index: tiff-4.4.0/tools/tiffcrop.c -=================================================================== ---- tiff-4.4.0.orig/tools/tiffcrop.c -+++ tiff-4.4.0/tools/tiffcrop.c -@@ -108,8 +108,10 @@ - * lower level, scanline level routines. Debug reports a limited set - * of messages to monitor progress without enabling dump logs. - * -- * Note: The (-X|-Y), -Z, -z and -S options are mutually exclusive. -+ * Note 1: The (-X|-Y), -Z, -z and -S options are mutually exclusive. - * In no case should the options be applied to a given selection successively. -+ * Note 2: Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options -+ * such as -H, -V, -P, -J or -K are not supported and may cause buffer overflows. - */ - - static char tiffcrop_version_id[] = "2.5"; -@@ -781,8 +783,10 @@ static const char usage_info[] = - " The four debug/dump options are independent, though it makes little sense to\n" - " specify a dump file without specifying a detail level.\n" - "\n" --"Note: The (-X|-Y), -Z, -z and -S options are mutually exclusive.\n" -+"Note 1: The (-X|-Y), -Z, -z and -S options are mutually exclusive.\n" - " In no case should the options be applied to a given selection successively.\n" -+"Note 2: Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options\n" -+" such as - H, -V, -P, -J or -K are not supported and may cause buffer overflows.\n" - "\n" - ; - -@@ -2138,9 +2142,20 @@ void process_command_opts (int argc, ch - R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0; - S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0; - if (XY + Z + R + S > 1) { -- TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit"); -+ TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->exit"); - exit(EXIT_FAILURE); - } -+ -+ /* Check for not allowed combination: -+ * Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options -+ * such as -H, -V, -P, -J or -K are not supported and may cause buffer overflows. -+. */ -+ if ((XY + Z + R > 0) && page->mode != PAGE_MODE_NONE) { -+ TIFFError("tiffcrop input error", -+ "Any of the crop options -X, -Y, -Z and -z together with other PAGE_MODE_x options such as - H, -V, -P, -J or -K is not supported and may cause buffer overflows..->exit"); -+ exit(EXIT_FAILURE); -+ } -+ - } /* end process_command_opts */ - - /* Start a new output file if one has not been previously opened or -@@ -2411,6 +2426,7 @@ main(int argc, char* argv[]) - exit (EXIT_FAILURE); - } - -+ /* Crop input image and copy zones and regions from input image into seg_buffs or crop_buff. */ - if (crop.selections > 0) - { - if (processCropSelections(&image, &crop, &read_buff, seg_buffs)) -@@ -2427,6 +2443,7 @@ main(int argc, char* argv[]) - exit (EXIT_FAILURE); - } - } -+ /* Format and write selected image parts to output file(s). */ - if (page.mode == PAGE_MODE_NONE) - { /* Whole image or sections not based on output page size */ - if (crop.selections > 0) diff --git a/tiff-CVE-2022-3598.patch b/tiff-CVE-2022-3598.patch deleted file mode 100644 index 4b49c4b..0000000 --- a/tiff-CVE-2022-3598.patch +++ /dev/null @@ -1,639 +0,0 @@ -Index: tiff-4.4.0/tools/tiffcrop.c -=================================================================== ---- tiff-4.4.0.orig/tools/tiffcrop.c -+++ tiff-4.4.0/tools/tiffcrop.c -@@ -212,6 +212,10 @@ static char tiffcrop_rev_date[] = "02- - - #define TIFF_DIR_MAX 65534 - -+/* Some conversion subroutines require image buffers, which are at least 3 bytes -+ * larger than the necessary size for the image itself. */ -+#define NUM_BUFF_OVERSIZE_BYTES 3 -+ - /* Offsets into buffer for margins and fixed width and length segments */ - struct offset { - uint32_t tmargin; -@@ -233,7 +237,7 @@ struct offset { - */ - - struct buffinfo { -- uint32_t size; /* size of this buffer */ -+ size_t size; /* size of this buffer */ - unsigned char *buffer; /* address of the allocated buffer */ - }; - -@@ -809,8 +813,8 @@ static int readContigTilesIntoBuffer (TI - uint32_t dst_rowsize, shift_width; - uint32_t bytes_per_sample, bytes_per_pixel; - uint32_t trailing_bits, prev_trailing_bits; -- uint32_t tile_rowsize = TIFFTileRowSize(in); -- uint32_t src_offset, dst_offset; -+ tmsize_t tile_rowsize = TIFFTileRowSize(in); -+ tmsize_t src_offset, dst_offset; - uint32_t row_offset, col_offset; - uint8_t *bufp = (uint8_t*) buf; - unsigned char *src = NULL; -@@ -860,7 +864,7 @@ static int readContigTilesIntoBuffer (TI - TIFFError("readContigTilesIntoBuffer", "Integer overflow when calculating buffer size."); - exit(EXIT_FAILURE); - } -- tilebuf = limitMalloc(tile_buffsize + 3); -+ tilebuf = limitMalloc(tile_buffsize + NUM_BUFF_OVERSIZE_BYTES); - if (tilebuf == 0) - return 0; - tilebuf[tile_buffsize] = 0; -@@ -1023,7 +1027,7 @@ static int readSeparateTilesIntoBuffer - for (sample = 0; (sample < spp) && (sample < MAX_SAMPLES); sample++) - { - srcbuffs[sample] = NULL; -- tbuff = (unsigned char *)limitMalloc(tilesize + 8); -+ tbuff = (unsigned char *)limitMalloc(tilesize + NUM_BUFF_OVERSIZE_BYTES); - if (!tbuff) - { - TIFFError ("readSeparateTilesIntoBuffer", -@@ -1216,7 +1220,8 @@ writeBufferToSeparateStrips (TIFF* out, - } - rowstripsize = rowsperstrip * bytes_per_sample * (width + 1); - -- obuf = limitMalloc (rowstripsize); -+ /* Add 3 padding bytes for extractContigSamples32bits */ -+ obuf = limitMalloc (rowstripsize + NUM_BUFF_OVERSIZE_BYTES); - if (obuf == NULL) - return 1; - -@@ -1228,7 +1233,7 @@ writeBufferToSeparateStrips (TIFF* out, - - stripsize = TIFFVStripSize(out, nrows); - src = buf + (row * rowsize); -- memset (obuf, '\0', rowstripsize); -+ memset (obuf, '\0',rowstripsize + NUM_BUFF_OVERSIZE_BYTES); - if (extractContigSamplesToBuffer(obuf, src, nrows, width, s, spp, bps, dump)) - { - _TIFFfree(obuf); -@@ -1236,10 +1241,15 @@ writeBufferToSeparateStrips (TIFF* out, - } - if ((dump->outfile != NULL) && (dump->level == 1)) - { -- dump_info(dump->outfile, dump->format,"", -+ if (scanlinesize > 0x0ffffffffULL) { -+ dump_info(dump->infile, dump->format, "loadImage", -+ "Attention: scanlinesize %"PRIu64" is larger than UINT32_MAX.\nFollowing dump might be wrong.", -+ scanlinesize); -+ } -+ dump_info(dump->outfile, dump->format,"", - "Sample %2d, Strip: %2d, bytes: %4d, Row %4d, bytes: %4d, Input offset: %6d", -- s + 1, strip + 1, stripsize, row + 1, scanlinesize, src - buf); -- dump_buffer(dump->outfile, dump->format, nrows, scanlinesize, row, obuf); -+ s + 1, strip + 1, stripsize, row + 1, (uint32_t)scanlinesize, src - buf); -+ dump_buffer(dump->outfile, dump->format, nrows, (uint32_t)scanlinesize, row, obuf); - } - - if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) -@@ -1266,7 +1276,7 @@ static int writeBufferToContigTiles (TIF - uint32_t tl, tw; - uint32_t row, col, nrow, ncol; - uint32_t src_rowsize, col_offset; -- uint32_t tile_rowsize = TIFFTileRowSize(out); -+ tmsize_t tile_rowsize = TIFFTileRowSize(out); - uint8_t* bufp = (uint8_t*) buf; - tsize_t tile_buffsize = 0; - tsize_t tilesize = TIFFTileSize(out); -@@ -1309,9 +1319,11 @@ static int writeBufferToContigTiles (TIF - } - src_rowsize = ((imagewidth * spp * bps) + 7U) / 8; - -- tilebuf = limitMalloc(tile_buffsize); -+ /* Add 3 padding bytes for extractContigSamples32bits */ -+ tilebuf = limitMalloc(tile_buffsize + NUM_BUFF_OVERSIZE_BYTES); - if (tilebuf == 0) - return 1; -+ memset(tilebuf, 0, tile_buffsize + NUM_BUFF_OVERSIZE_BYTES); - for (row = 0; row < imagelength; row += tl) - { - nrow = (row + tl > imagelength) ? imagelength - row : tl; -@@ -1357,7 +1369,8 @@ static int writeBufferToSeparateTiles (T - uint32_t imagewidth, tsample_t spp, - struct dump_opts * dump) - { -- tdata_t obuf = limitMalloc(TIFFTileSize(out)); -+ /* Add 3 padding bytes for extractContigSamples32bits */ -+ tdata_t obuf = limitMalloc(TIFFTileSize(out) + NUM_BUFF_OVERSIZE_BYTES); - uint32_t tl, tw; - uint32_t row, col, nrow, ncol; - uint32_t src_rowsize, col_offset; -@@ -1367,6 +1380,7 @@ static int writeBufferToSeparateTiles (T - - if (obuf == NULL) - return 1; -+ memset(obuf, 0, TIFFTileSize(out) + NUM_BUFF_OVERSIZE_BYTES); - - if( !TIFFGetField(out, TIFFTAG_TILELENGTH, &tl) || - !TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw) || -@@ -1792,14 +1806,14 @@ void process_command_opts (int argc, ch - - *opt_offset = '\0'; - /* convert option to lowercase */ -- end = strlen (opt_ptr); -+ end = (unsigned int)strlen (opt_ptr); - for (i = 0; i < end; i++) - *(opt_ptr + i) = tolower((int) *(opt_ptr + i)); - /* Look for dump format specification */ - if (strncmp(opt_ptr, "for", 3) == 0) - { - /* convert value to lowercase */ -- end = strlen (opt_offset + 1); -+ end = (unsigned int)strlen (opt_offset + 1); - for (i = 1; i <= end; i++) - *(opt_offset + i) = tolower((int) *(opt_offset + i)); - /* check dump format value */ -@@ -2272,6 +2286,8 @@ main(int argc, char* argv[]) - size_t length; - char temp_filename[PATH_MAX + 16]; /* Extra space keeps the compiler from complaining */ - -+ assert(NUM_BUFF_OVERSIZE_BYTES >= 3); -+ - little_endian = *((unsigned char *)&little_endian) & '1'; - - initImageData(&image); -@@ -3226,13 +3242,13 @@ extractContigSamples32bits (uint8_t *in, - /* If we have a full buffer's worth, write it out */ - if (ready_bits >= 32) - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -3641,13 +3657,13 @@ extractContigSamplesShifted32bits (uint8 - } - else /* If we have a full buffer's worth, write it out */ - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -3824,10 +3840,10 @@ extractContigSamplesToTileBuffer(uint8_t - static int readContigStripsIntoBuffer (TIFF* in, uint8_t* buf) - { - uint8_t* bufp = buf; -- int32_t bytes_read = 0; -+ tmsize_t bytes_read = 0; - uint32_t strip, nstrips = TIFFNumberOfStrips(in); -- uint32_t stripsize = TIFFStripSize(in); -- uint32_t rows = 0; -+ tmsize_t stripsize = TIFFStripSize(in); -+ tmsize_t rows = 0; - uint32_t rps = TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps); - tsize_t scanline_size = TIFFScanlineSize(in); - -@@ -3840,11 +3856,11 @@ static int readContigStripsIntoBuffer (T - bytes_read = TIFFReadEncodedStrip (in, strip, bufp, -1); - rows = bytes_read / scanline_size; - if ((strip < (nstrips - 1)) && (bytes_read != (int32_t)stripsize)) -- TIFFError("", "Strip %"PRIu32": read %"PRId32" bytes, strip size %"PRIu32, -+ TIFFError("", "Strip %"PRIu32": read %"PRId64" bytes, strip size %"PRIu64, - strip + 1, bytes_read, stripsize); - - if (bytes_read < 0 && !ignore) { -- TIFFError("", "Error reading strip %"PRIu32" after %"PRIu32" rows", -+ TIFFError("", "Error reading strip %"PRIu32" after %"PRIu64" rows", - strip, rows); - return 0; - } -@@ -4309,13 +4325,13 @@ combineSeparateSamples32bits (uint8_t *i - /* If we have a full buffer's worth, write it out */ - if (ready_bits >= 32) - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -4358,10 +4374,10 @@ combineSeparateSamples32bits (uint8_t *i - "Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d", - row + 1, col + 1, src_byte, src_bit, dst - out); - -- dump_long (dumpfile, format, "Match bits ", matchbits); -+ dump_wide (dumpfile, format, "Match bits ", matchbits); - dump_data (dumpfile, format, "Src bits ", src, 4); -- dump_long (dumpfile, format, "Buff1 bits ", buff1); -- dump_long (dumpfile, format, "Buff2 bits ", buff2); -+ dump_wide (dumpfile, format, "Buff1 bits ", buff1); -+ dump_wide (dumpfile, format, "Buff2 bits ", buff2); - dump_byte (dumpfile, format, "Write bits1", bytebuff1); - dump_byte (dumpfile, format, "Write bits2", bytebuff2); - dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits); -@@ -4834,13 +4850,13 @@ combineSeparateTileSamples32bits (uint8_ - /* If we have a full buffer's worth, write it out */ - if (ready_bits >= 32) - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -4883,10 +4899,10 @@ combineSeparateTileSamples32bits (uint8_ - "Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d", - row + 1, col + 1, src_byte, src_bit, dst - out); - -- dump_long (dumpfile, format, "Match bits ", matchbits); -+ dump_wide (dumpfile, format, "Match bits ", matchbits); - dump_data (dumpfile, format, "Src bits ", src, 4); -- dump_long (dumpfile, format, "Buff1 bits ", buff1); -- dump_long (dumpfile, format, "Buff2 bits ", buff2); -+ dump_wide (dumpfile, format, "Buff1 bits ", buff1); -+ dump_wide (dumpfile, format, "Buff2 bits ", buff2); - dump_byte (dumpfile, format, "Write bits1", bytebuff1); - dump_byte (dumpfile, format, "Write bits2", bytebuff2); - dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits); -@@ -4909,7 +4925,7 @@ static int readSeparateStripsIntoBuffer - { - int i, bytes_per_sample, bytes_per_pixel, shift_width, result = 1; - uint32_t j; -- int32_t bytes_read = 0; -+ tmsize_t bytes_read = 0; - uint16_t bps = 0, planar; - uint32_t nstrips; - uint32_t strips_per_sample; -@@ -4975,7 +4991,7 @@ static int readSeparateStripsIntoBuffer - for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++) - { - srcbuffs[s] = NULL; -- buff = limitMalloc(stripsize + 3); -+ buff = limitMalloc(stripsize + NUM_BUFF_OVERSIZE_BYTES); - if (!buff) - { - TIFFError ("readSeparateStripsIntoBuffer", -@@ -4998,7 +5014,7 @@ static int readSeparateStripsIntoBuffer - buff = srcbuffs[s]; - strip = (s * strips_per_sample) + j; - bytes_read = TIFFReadEncodedStrip (in, strip, buff, stripsize); -- rows_this_strip = bytes_read / src_rowsize; -+ rows_this_strip = (uint32_t)(bytes_read / src_rowsize); - if (bytes_read < 0 && !ignore) - { - TIFFError(TIFFFileName(in), -@@ -6061,13 +6077,14 @@ loadImage(TIFF* in, struct image_data *i - uint16_t input_compression = 0, input_photometric = 0; - uint16_t subsampling_horiz, subsampling_vert; - uint32_t width = 0, length = 0; -- uint32_t stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0; -+ tmsize_t stsize = 0, tlsize = 0, buffsize = 0; -+ tmsize_t scanlinesize = 0; - uint32_t tw = 0, tl = 0; /* Tile width and length */ -- uint32_t tile_rowsize = 0; -+ tmsize_t tile_rowsize = 0; - unsigned char *read_buff = NULL; - unsigned char *new_buff = NULL; - int readunit = 0; -- static uint32_t prev_readsize = 0; -+ static tmsize_t prev_readsize = 0; - - TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps); - TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp); -@@ -6324,6 +6341,8 @@ loadImage(TIFF* in, struct image_data *i - /* The buffsize_check and the possible adaptation of buffsize - * has to account also for padding of each line to a byte boundary. - * This is assumed by mirrorImage() and rotateImage(). -+ * Furthermore, functions like extractContigSamplesShifted32bits() -+ * need a buffer, which is at least 3 bytes larger than the actual image. - * Otherwise buffer-overflow might occur there. - */ - buffsize_check = length * (uint32_t)(((width * spp * bps) + 7) / 8); -@@ -6375,7 +6394,7 @@ loadImage(TIFF* in, struct image_data *i - TIFFError("loadImage", "Unable to allocate/reallocate read buffer"); - return (-1); - } -- read_buff = (unsigned char *)limitMalloc(buffsize+3); -+ read_buff = (unsigned char *)limitMalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - { -@@ -6386,11 +6405,11 @@ loadImage(TIFF* in, struct image_data *i - TIFFError("loadImage", "Unable to allocate/reallocate read buffer"); - return (-1); - } -- new_buff = _TIFFrealloc(read_buff, buffsize+3); -+ new_buff = _TIFFrealloc(read_buff, buffsize + NUM_BUFF_OVERSIZE_BYTES); - if (!new_buff) - { - free (read_buff); -- read_buff = (unsigned char *)limitMalloc(buffsize+3); -+ read_buff = (unsigned char *)limitMalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - read_buff = new_buff; -@@ -6463,8 +6482,14 @@ loadImage(TIFF* in, struct image_data *i - dump_info (dump->infile, dump->format, "", - "Bits per sample %"PRIu16", Samples per pixel %"PRIu16, bps, spp); - -+ if (scanlinesize > 0x0ffffffffULL) { -+ dump_info(dump->infile, dump->format, "loadImage", -+ "Attention: scanlinesize %"PRIu64" is larger than UINT32_MAX.\nFollowing dump might be wrong.", -+ scanlinesize); -+ } -+ - for (i = 0; i < length; i++) -- dump_buffer(dump->infile, dump->format, 1, scanlinesize, -+ dump_buffer(dump->infile, dump->format, 1, (uint32_t)scanlinesize, - i, read_buff + (i * scanlinesize)); - } - return (0); -@@ -7484,13 +7509,13 @@ writeSingleSection(TIFF *in, TIFF *out, - if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) { - TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks); - if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) { -- int inknameslen = strlen(inknames) + 1; -+ int inknameslen = (int)strlen(inknames) + 1; - const char* cp = inknames; - while (ninks > 1) { - cp = strchr(cp, '\0'); - if (cp) { - cp++; -- inknameslen += (strlen(cp) + 1); -+ inknameslen += ((int)strlen(cp) + 1); - } - ninks--; - } -@@ -7553,23 +7578,23 @@ createImageSection(uint32_t sectsize, un - - if (!sect_buff) - { -- sect_buff = (unsigned char *)limitMalloc(sectsize); -+ sect_buff = (unsigned char *)limitMalloc(sectsize + NUM_BUFF_OVERSIZE_BYTES); - if (!sect_buff) - { - TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); - return (-1); - } -- _TIFFmemset(sect_buff, 0, sectsize); -+ _TIFFmemset(sect_buff, 0, sectsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - { - if (prev_sectsize < sectsize) - { -- new_buff = _TIFFrealloc(sect_buff, sectsize); -+ new_buff = _TIFFrealloc(sect_buff, sectsize + NUM_BUFF_OVERSIZE_BYTES); - if (!new_buff) - { - _TIFFfree (sect_buff); -- sect_buff = (unsigned char *)limitMalloc(sectsize); -+ sect_buff = (unsigned char *)limitMalloc(sectsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - sect_buff = new_buff; -@@ -7579,7 +7604,7 @@ createImageSection(uint32_t sectsize, un - TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); - return (-1); - } -- _TIFFmemset(sect_buff, 0, sectsize); -+ _TIFFmemset(sect_buff, 0, sectsize + NUM_BUFF_OVERSIZE_BYTES); - } - } - -@@ -7610,17 +7635,17 @@ processCropSelections(struct image_data - cropsize = crop->bufftotal; - crop_buff = seg_buffs[0].buffer; - if (!crop_buff) -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - else - { - prev_cropsize = seg_buffs[0].size; - if (prev_cropsize < cropsize) - { -- next_buff = _TIFFrealloc(crop_buff, cropsize); -+ next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (! next_buff) - { - _TIFFfree (crop_buff); -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - crop_buff = next_buff; -@@ -7633,7 +7658,8 @@ processCropSelections(struct image_data - return (-1); - } - -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); -+ - seg_buffs[0].buffer = crop_buff; - seg_buffs[0].size = cropsize; - -@@ -7713,17 +7739,17 @@ processCropSelections(struct image_data - cropsize = crop->bufftotal; - crop_buff = seg_buffs[i].buffer; - if (!crop_buff) -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - else - { - prev_cropsize = seg_buffs[0].size; - if (prev_cropsize < cropsize) - { -- next_buff = _TIFFrealloc(crop_buff, cropsize); -+ next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (! next_buff) - { - _TIFFfree (crop_buff); -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - crop_buff = next_buff; -@@ -7736,7 +7762,7 @@ processCropSelections(struct image_data - return (-1); - } - -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); - seg_buffs[i].buffer = crop_buff; - seg_buffs[i].size = cropsize; - -@@ -7852,24 +7878,24 @@ createCroppedImage(struct image_data *im - crop_buff = *crop_buff_ptr; - if (!crop_buff) - { -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (!crop_buff) - { - TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer"); - return (-1); - } -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); - prev_cropsize = cropsize; - } - else - { - if (prev_cropsize < cropsize) - { -- new_buff = _TIFFrealloc(crop_buff, cropsize); -+ new_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (!new_buff) - { - free (crop_buff); -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - crop_buff = new_buff; -@@ -7878,7 +7904,8 @@ createCroppedImage(struct image_data *im - TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer"); - return (-1); - } -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); -+ - } - } - -@@ -8176,13 +8203,13 @@ writeCroppedImage(TIFF *in, TIFF *out, s - if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) { - TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks); - if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) { -- int inknameslen = strlen(inknames) + 1; -+ int inknameslen = (int)strlen(inknames) + 1; - const char* cp = inknames; - while (ninks > 1) { - cp = strchr(cp, '\0'); - if (cp) { - cp++; -- inknameslen += (strlen(cp) + 1); -+ inknameslen += ((int)strlen(cp) + 1); - } - ninks--; - } -@@ -8567,13 +8594,13 @@ rotateContigSamples32bits(uint16_t rotat - } - else /* If we have a full buffer's worth, write it out */ - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -8642,12 +8669,13 @@ rotateImage(uint16_t rotation, struct im - return (-1); - } - -- if (!(rbuff = (unsigned char *)limitMalloc(buffsize))) -+ /* Add 3 padding bytes for extractContigSamplesShifted32bits */ -+ if (!(rbuff = (unsigned char *)limitMalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES))) - { -- TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize); -+ TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize + NUM_BUFF_OVERSIZE_BYTES); - return (-1); - } -- _TIFFmemset(rbuff, '\0', buffsize); -+ _TIFFmemset(rbuff, '\0', buffsize + NUM_BUFF_OVERSIZE_BYTES); - - ibuff = *ibuff_ptr; - switch (rotation) -@@ -9175,13 +9203,13 @@ reverseSamples32bits (uint16_t spp, uint - } - else /* If we have a full buffer's worth, write it out */ - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -9272,12 +9300,13 @@ mirrorImage(uint16_t spp, uint16_t bps, - { - case MIRROR_BOTH: - case MIRROR_VERT: -- line_buff = (unsigned char *)limitMalloc(rowsize); -+ line_buff = (unsigned char *)limitMalloc(rowsize + NUM_BUFF_OVERSIZE_BYTES); - if (line_buff == NULL) - { -- TIFFError ("mirrorImage", "Unable to allocate mirror line buffer of %1u bytes", rowsize); -+ TIFFError ("mirrorImage", "Unable to allocate mirror line buffer of %1u bytes", rowsize + NUM_BUFF_OVERSIZE_BYTES); - return (-1); - } -+ _TIFFmemset(line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES); - - dst = ibuff + (rowsize * (length - 1)); - for (row = 0; row < length / 2; row++) -@@ -9309,11 +9338,12 @@ mirrorImage(uint16_t spp, uint16_t bps, - } - else - { /* non 8 bit per sample data */ -- if (!(line_buff = (unsigned char *)limitMalloc(rowsize + 1))) -+ if (!(line_buff = (unsigned char *)limitMalloc(rowsize + NUM_BUFF_OVERSIZE_BYTES))) - { - TIFFError("mirrorImage", "Unable to allocate mirror line buffer"); - return (-1); - } -+ _TIFFmemset(line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES); - bytes_per_sample = (bps + 7) / 8; - bytes_per_pixel = ((bps * spp) + 7) / 8; - if (bytes_per_pixel < (bytes_per_sample + 1)) -@@ -9325,7 +9355,7 @@ mirrorImage(uint16_t spp, uint16_t bps, - { - row_offset = row * rowsize; - src = ibuff + row_offset; -- _TIFFmemset (line_buff, '\0', rowsize); -+ _TIFFmemset (line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES); - switch (shift_width) - { - case 1: if (reverseSamples16bits(spp, bps, width, src, line_buff)) diff --git a/tiff-CVE-2022-3599.patch b/tiff-CVE-2022-3599.patch deleted file mode 100644 index 108439d..0000000 --- a/tiff-CVE-2022-3599.patch +++ /dev/null @@ -1,228 +0,0 @@ -Index: tiff-4.4.0/libtiff/tif_dir.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_dir.c -+++ tiff-4.4.0/libtiff/tif_dir.c -@@ -136,32 +136,31 @@ setExtraSamples(TIFF* tif, va_list ap, u - } - - /* -- * Confirm we have "samplesperpixel" ink names separated by \0. Returns -+ * Count ink names separated by \0. Returns - * zero if the ink names are not as expected. - */ --static uint32_t --checkInkNamesString(TIFF* tif, uint32_t slen, const char* s) -+static uint16_t -+countInkNamesString(TIFF *tif, uint32_t slen, const char *s) - { -- TIFFDirectory* td = &tif->tif_dir; -- uint16_t i = td->td_samplesperpixel; -+ uint16_t i = 0; -+ const char *ep = s + slen; -+ const char *cp = s; - - if (slen > 0) { -- const char* ep = s+slen; -- const char* cp = s; -- for (; i > 0; i--) { -+ do { - for (; cp < ep && *cp != '\0'; cp++) {} - if (cp >= ep) - goto bad; - cp++; /* skip \0 */ -- } -- return ((uint32_t)(cp - s)); -+ i++; -+ } while (cp < ep); -+ return (i); - } - bad: - TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", -- "%s: Invalid InkNames value; expecting %"PRIu16" names, found %"PRIu16, -- tif->tif_name, -- td->td_samplesperpixel, -- (uint16_t)(td->td_samplesperpixel-i)); -+ "%s: Invalid InkNames value; no NUL at given buffer end location %"PRIu32", after %"PRIu16" ink", -+ tif->tif_name, slen, i); -+ - return (0); - } - -@@ -475,13 +474,61 @@ _TIFFVSetField(TIFF* tif, uint32_t tag, - _TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6); - break; - case TIFFTAG_INKNAMES: -- v = (uint16_t) va_arg(ap, uint16_vap); -- s = va_arg(ap, char*); -- v = checkInkNamesString(tif, v, s); -- status = v > 0; -- if( v > 0 ) { -- _TIFFsetNString(&td->td_inknames, s, v); -- td->td_inknameslen = v; -+{ -+ v = (uint16_t) va_arg(ap, uint16_vap); -+ s = va_arg(ap, char*); -+ uint16_t ninksinstring; -+ ninksinstring = countInkNamesString(tif, v, s); -+ status = ninksinstring > 0; -+ if(ninksinstring > 0 ) { -+ _TIFFsetNString(&td->td_inknames, s, v); -+ td->td_inknameslen = v; -+ /* Set NumberOfInks to the value ninksinstring */ -+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) -+ { -+ if (td->td_numberofinks != ninksinstring) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Warning %s; Tag %s:\n Value %"PRIu16" of NumberOfInks is different from the number of inks %"PRIu16".\n -> NumberOfInks value adapted to %"PRIu16"", -+ tif->tif_name, fip->field_name, td->td_numberofinks, ninksinstring, ninksinstring); -+ td->td_numberofinks = ninksinstring; -+ } -+ } else { -+ td->td_numberofinks = ninksinstring; -+ TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS); -+ } -+ if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL)) -+ { -+ if (td->td_numberofinks != td->td_samplesperpixel) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Warning %s; Tag %s:\n Value %"PRIu16" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"", -+ tif->tif_name, fip->field_name, td->td_numberofinks, td->td_samplesperpixel); -+ } -+ } -+ } -+ } -+ break; -+ case TIFFTAG_NUMBEROFINKS: -+ v = (uint16_t)va_arg(ap, uint16_vap); -+ /* If InkNames already set also NumberOfInks is set accordingly and should be equal */ -+ if (TIFFFieldSet(tif, FIELD_INKNAMES)) -+ { -+ if (v != td->td_numberofinks) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Error %s; Tag %s:\n It is not possible to set the value %"PRIu32" for NumberOfInks\n which is different from the number of inks in the InkNames tag (%"PRIu16")", -+ tif->tif_name, fip->field_name, v, td->td_numberofinks); -+ /* Do not set / overwrite number of inks already set by InkNames case accordingly. */ -+ status = 0; -+ } -+ } else { -+ td->td_numberofinks = (uint16_t)v; -+ if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL)) -+ { -+ if (td->td_numberofinks != td->td_samplesperpixel) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Warning %s; Tag %s:\n Value %"PRIu32" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"", -+ tif->tif_name, fip->field_name, v, td->td_samplesperpixel); -+ } -+ } - } - break; - case TIFFTAG_PERSAMPLE: -@@ -916,34 +963,6 @@ _TIFFVGetField(TIFF* tif, uint32_t tag, - standard_tag = 0; - } - -- if( standard_tag == TIFFTAG_NUMBEROFINKS ) -- { -- int i; -- for (i = 0; i < td->td_customValueCount; i++) { -- uint16_t val; -- TIFFTagValue *tv = td->td_customValues + i; -- if (tv->info->field_tag != standard_tag) -- continue; -- if( tv->value == NULL ) -- return 0; -- val = *(uint16_t *)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 %"PRIu16, -- val, td->td_samplesperpixel); -- val = td->td_samplesperpixel; -- } -- *va_arg(ap, uint16_t*) = val; -- return 1; -- } -- return 0; -- } -- - switch (standard_tag) { - case TIFFTAG_SUBFILETYPE: - *va_arg(ap, uint32_t*) = td->td_subfiletype; -@@ -1124,6 +1143,9 @@ _TIFFVGetField(TIFF* tif, uint32_t tag, - case TIFFTAG_INKNAMES: - *va_arg(ap, const char**) = td->td_inknames; - break; -+ case TIFFTAG_NUMBEROFINKS: -+ *va_arg(ap, uint16_t *) = td->td_numberofinks; -+ break; - default: - { - int i; -Index: tiff-4.4.0/libtiff/tif_dir.h -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_dir.h -+++ tiff-4.4.0/libtiff/tif_dir.h -@@ -117,6 +117,7 @@ typedef struct { - /* CMYK parameters */ - int td_inknameslen; - char* td_inknames; -+ uint16_t td_numberofinks; /* number of inks in InkNames string */ - - int td_customValueCount; - TIFFTagValue *td_customValues; -@@ -174,6 +175,7 @@ typedef struct { - #define FIELD_TRANSFERFUNCTION 44 - #define FIELD_INKNAMES 46 - #define FIELD_SUBIFD 49 -+#define FIELD_NUMBEROFINKS 50 - /* FIELD_CUSTOM (see tiffio.h) 65 */ - /* end of support for well-known tags; codec-private tags follow */ - #define FIELD_CODEC 66 /* base of codec-private tags */ -Index: tiff-4.4.0/libtiff/tif_dirinfo.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_dirinfo.c -+++ tiff-4.4.0/libtiff/tif_dirinfo.c -@@ -114,7 +114,7 @@ tiffFields[] = { - { TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray*) &tiffFieldArray }, - { TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL }, - { TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL }, -- { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NumberOfInks", NULL }, -+ { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_NUMBEROFINKS, 1, 0, "NumberOfInks", NULL }, - { TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DotRange", NULL }, - { TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL }, - { TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL }, -Index: tiff-4.4.0/libtiff/tif_dirwrite.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_dirwrite.c -+++ tiff-4.4.0/libtiff/tif_dirwrite.c -@@ -708,6 +708,11 @@ TIFFWriteDirectorySec(TIFF* tif, int isi - if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,TIFFTAG_INKNAMES,tif->tif_dir.td_inknameslen,tif->tif_dir.td_inknames)) - goto bad; - } -+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) -+ { -+ if (!TIFFWriteDirectoryTagShort(tif, &ndir, dir, TIFFTAG_NUMBEROFINKS, tif->tif_dir.td_numberofinks)) -+ goto bad; -+ } - if (TIFFFieldSet(tif,FIELD_SUBIFD)) - { - if (!TIFFWriteDirectoryTagSubifd(tif,&ndir,dir)) -Index: tiff-4.4.0/libtiff/tif_print.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_print.c -+++ tiff-4.4.0/libtiff/tif_print.c -@@ -401,6 +401,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, - } - fputs("\n", fd); - } -+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) { -+ fprintf(fd, " NumberOfInks: %d\n", -+ td->td_numberofinks); -+ } - if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) { - fprintf(fd, " Thresholding: "); - switch (td->td_threshholding) { diff --git a/tiff-CVE-2022-3970.patch b/tiff-CVE-2022-3970.patch deleted file mode 100644 index 7e29e61..0000000 --- a/tiff-CVE-2022-3970.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: tiff-4.4.0/libtiff/tif_getimage.c -=================================================================== ---- tiff-4.4.0.orig/libtiff/tif_getimage.c -+++ tiff-4.4.0/libtiff/tif_getimage.c -@@ -3058,15 +3058,15 @@ TIFFReadRGBATileExt(TIFF* tif, uint32_t - return( ok ); - - for( i_row = 0; i_row < read_ysize; i_row++ ) { -- memmove( raster + (tile_ysize - i_row - 1) * tile_xsize, -- raster + (read_ysize - i_row - 1) * read_xsize, -+ memmove( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize, -+ raster + (size_t)(read_ysize - i_row - 1) * read_xsize, - read_xsize * sizeof(uint32_t) ); -- _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize, -+ _TIFFmemset( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize+read_xsize, - 0, sizeof(uint32_t) * (tile_xsize - read_xsize) ); - } - - for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) { -- _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize, -+ _TIFFmemset( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize, - 0, sizeof(uint32_t) * tile_xsize ); - } - diff --git a/tiff.changes b/tiff.changes index 432678c..669d7f4 100644 --- a/tiff.changes +++ b/tiff.changes @@ -1,3 +1,54 @@ +------------------------------------------------------------------- +Wed Jan 4 08:48:13 UTC 2023 - Paolo Stivanin + +- Update to 4.5.0: + * tdir_t type updated to uint32_t. This type is now used for the return + value of TIFFCurrentDirectory() and TIFFNumberOfDirectories(), and as + the argument of TIFFSetDirectory() and TIFFUnlinkDirectory() + * Addition of an open option concept with the new functions TIFFOpenExt(), + TIFFOpenWExt(), TIFFFdOpenExt(), TIFFClientOpenExt(), TIFFOpenOptionsAlloc(), + TIFFOpenOptionsFree() + * Leveraging above mentioned open option concept, addition of a new capability + to limit the size of a single dynamic memory allocation done by the library + with TIFFOpenOptionsSetMaxSingleMemAlloc() + * Related to IFD-Loop detection refactoring, the number of IFDs that libtiff + can browse through has been extended from 65535 to 1048576. This value is + a build-time setting that can be configured with CMake's TIFF_MAX_DIR_COUNT + variable or autoconf's --with-max-dir-count option. + * Whole code base reformatting of .c/.h files using new .clang-format format + * Documentation changed from static HTML and man pages to + Restructured Text (rst). HTML and man pages are now build artifacts. + * SONAME version bumped to 6 due to changes in symbol versioning. + * autoconf/cmake: detect (not yet released) libjpeg-turbo 2.2 to take into + its capability of handling both 8-bit JPEG and 12-bit JPEG in a single build. + * autoconf/cmake: detect sphinx-build to build HTML and man pages + * CMakeLists.txt: fix warning with -Wdev + * CMake: correctly set default value of 'lzma' option when liblzma is detected + * CMake: Moved linking of CMath::CMath into CMath_LIBRARY check. + * Fix CMake build to be compatible with FetchContent. + * cmake: Correct duplicate definition of _CRT_SECURE_NO_WARNINGS + * cmake: Fixes for Visual Studio 2022. + * Adds Requires.private generation so that pkg-config can correctly find + the dependencies of libtiff. + * Fix dependency on libm on Android + * Fix build in tif_lzw.c + * CMake: Add options for disabling tools, tests, contrib and docs. + * tiffcrop: Fix memory allocation to require a larger buffer (CVE-2022-3570, CVE-2022-3598) + * tiffcrop: disable incompatibility of -Z, -X, -Y, -z options with any PAGE_MODE_x option + (CVE-2022-3627, CVE-2022-3597, CVE-2022-3626) + * tiffcrop: fix floating-point exception (CVE-2022-2056, CVE-2022-2057, CVE-2022-2058) + * _TIFFCheckFieldIsValidForCodec(): return FALSE when passed a codec-specific tag + and the codec is not configured (CVE-2022-34526) + * Revised handling of TIFFTAG_INKNAMES and related TIFFTAG_NUMBEROFINKS value (CVE-2022-3599) + * tiffcrop: -S option mutually exclusive (CVE-2022-2519, CVE-2022-2520, CVE-2022-2521) +- Drop tiff-CVE-2022-3597,CVE-2022-3626,CVE-2022-3627.patch +- Drop tiff-CVE-2022-34526.patch +- Drop tiff-CVE-2022-3599.patch +- Drop tiff-CVE-2022-3598.patch +- Drop tiff-CVE-2022-3970.patch +- Drop tiff-CVE-2022-2519,CVE-2022-2520,CVE-2022-2521.patch +- Drop tiff-CVE-2022-2056,CVE-2022-2057,CVE-2022-2058.patch + ------------------------------------------------------------------- Mon Nov 14 11:54:03 UTC 2022 - Michael Vetter diff --git a/tiff.spec b/tiff.spec index 2ce6ac0..3c724f2 100644 --- a/tiff.spec +++ b/tiff.spec @@ -1,7 +1,7 @@ # # spec file for package tiff # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define asan_build 0 %define debug_build 0 Name: tiff -Version: 4.4.0 +Version: 4.5.0 Release: 0 Summary: Tools for Converting from and to the Tagged Image File Format License: HPND @@ -33,13 +33,6 @@ Source99: tiff.keyring Patch0: tiff-4.0.3-seek.patch # http://bugzilla.maptools.org/show_bug.cgi?id=2442 Patch1: tiff-4.0.3-compress-warning.patch -Patch2: tiff-CVE-2022-2056,CVE-2022-2057,CVE-2022-2058.patch -Patch3: tiff-CVE-2022-34526.patch -Patch4: tiff-CVE-2022-2519,CVE-2022-2520,CVE-2022-2521.patch -Patch5: tiff-CVE-2022-3597,CVE-2022-3626,CVE-2022-3627.patch -Patch6: tiff-CVE-2022-3599.patch -Patch7: tiff-CVE-2022-3598.patch -Patch8: tiff-CVE-2022-3970.patch BuildRequires: gcc-c++ BuildRequires: libjbig-devel BuildRequires: libjpeg-devel @@ -53,12 +46,12 @@ BuildRequires: pkgconfig(zlib) This package contains the library and support programs for the TIFF image format. -%package -n libtiff5 +%package -n libtiff6 Summary: The Tiff Library (with JPEG and compression support) Group: System/Libraries Provides: libtiff = %{version} -%description -n libtiff5 +%description -n libtiff6 This package includes the tiff libraries. To link a program with libtiff, you will have to add -ljpeg and -lz to include the necessary libjpeg and libz in the linking process. @@ -68,7 +61,7 @@ Summary: Development Tools for Programs which will use the libtiff Librar Group: Development/Libraries/C and C++ Requires: glibc-devel Requires: libstdc++-devel -Requires: libtiff5 = %{version} +Requires: libtiff6 = %{version} %description -n libtiff-devel This package contains the header files and static libraries for @@ -76,16 +69,7 @@ developing programs which will manipulate TIFF format image files using the libtiff library. %prep -%setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 +%autosetup -p1 %build CFLAGS="%{optflags} -fPIE" @@ -111,12 +95,10 @@ done cp %{SOURCE2} . rm -rf %{buildroot}%{_datadir}/doc/tiff* find %{buildroot} -type f -name "*.la" -delete -print -find html -name "Makefile*" | xargs rm # remove pal2rgb, bsc#1071031 for tool in pal2rgb; do rm %{buildroot}%{_bindir}/$tool rm %{buildroot}%{_mandir}/man1/$tool.1 - rm html/man/$tool.1.html done %check @@ -128,17 +110,16 @@ for i in tools test; do (cd $i && make %{?_smp_mflags} check) done -%post -n libtiff5 -p /sbin/ldconfig -%postun -n libtiff5 -p /sbin/ldconfig +%post -n libtiff6 -p /sbin/ldconfig +%postun -n libtiff6 -p /sbin/ldconfig %files %{_bindir}/* -%doc html %doc README.md VERSION ChangeLog TODO RELEASE-DATE %{_mandir}/man1/* -%files -n libtiff5 -%license COPYRIGHT +%files -n libtiff6 +%license LICENSE.md %doc README.md README.SUSE %{_libdir}/*.so.*