diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2021-09-27 11:19:24 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2021-10-20 18:22:47 +0200 |
commit | cc6be9c3577168805ec34b2d396e63361012282b (patch) | |
tree | 7dc794b08a1a6a786d540516c623cb1eebfb1863 /lcms2mt/utils/tificc | |
parent | Import Ghostscript 9.54 (diff) | |
download | ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.gz ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.bz2 ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.zip |
Import Ghostscript 9.55ghostscript-9.55
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'lcms2mt/utils/tificc')
-rw-r--r-- | lcms2mt/utils/tificc/Makefile.in | 1 | ||||
-rw-r--r-- | lcms2mt/utils/tificc/tificc.c | 56 |
2 files changed, 36 insertions, 21 deletions
diff --git a/lcms2mt/utils/tificc/Makefile.in b/lcms2mt/utils/tificc/Makefile.in index 53bcd8b3..009654c5 100644 --- a/lcms2mt/utils/tificc/Makefile.in +++ b/lcms2mt/utils/tificc/Makefile.in @@ -272,6 +272,7 @@ LIB_ZLIB = @LIB_ZLIB@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ diff --git a/lcms2mt/utils/tificc/tificc.c b/lcms2mt/utils/tificc/tificc.c index 9801a1c4..91687d9f 100644 --- a/lcms2mt/utils/tificc/tificc.c +++ b/lcms2mt/utils/tificc/tificc.c @@ -29,6 +29,14 @@ #include "tiffio.h" #include "utils.h" +// Fix broken libtiff 4.3.0, thanks to Bob Friesenhahn for uncovering this + +#if defined(HAVE_STDINT_H) && (TIFFLIB_VERSION >= 20201219) +# undef uint16 +# define uint16 uint16_t +# undef uint32 +# define uint32 uint32_t +#endif /* TIFFLIB_VERSION */ // Flags @@ -57,16 +65,15 @@ static const char* SaveEmbedded = NULL; static void ConsoleWarningHandler(const char* module, const char* fmt, va_list ap) { - char e[512] = { '\0' }; - if (module != NULL) - strcat(strcpy(e, module), ": "); - - vsprintf(e+strlen(e), fmt, ap); - strcat(e, "."); if (Verbose) { - fprintf(stderr, "\nWarning"); - fprintf(stderr, " %s\n", e); + fprintf(stderr, "Warning: "); + + if (module != NULL) + fprintf(stderr, "[%s] ", module); + + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); fflush(stderr); } } @@ -74,18 +81,18 @@ void ConsoleWarningHandler(const char* module, const char* fmt, va_list ap) static void ConsoleErrorHandler(const char* module, const char* fmt, va_list ap) { - char e[512] = { '\0' }; + if (Verbose) { + + fprintf(stderr, "Error: "); - if (module != NULL) { - if (strlen(module) < 500) - strcat(strcpy(e, module), ": "); + if (module != NULL) + fprintf(stderr, "[%s] ", module); + + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + fflush(stderr); } - vsprintf(e+strlen(e), fmt, ap); - strcat(e, "."); - fprintf(stderr, "\nError"); - fprintf(stderr, " %s\n", e); - fflush(stderr); } @@ -96,7 +103,7 @@ void Warning(const char *frm, ...) va_list args; va_start(args, frm); - ConsoleWarningHandler("[tificc]", frm, args); + ConsoleWarningHandler("tificc", frm, args); va_end(args); } @@ -304,6 +311,8 @@ cmsUInt32Number GetInputPixelType(TIFF *Bank) case PHOTOMETRIC_RGB: pt = PT_RGB; + if (ColorChannels < 3) + FatalError("Sorry, RGB needs at least 3 samples per pixel"); break; @@ -312,7 +321,6 @@ cmsUInt32Number GetInputPixelType(TIFF *Bank) break; case PHOTOMETRIC_SEPARATED: - pt = PixelTypeFromChanCount(ColorChannels); break; @@ -409,6 +417,9 @@ int TileBasedXform(cmsContext ContextID, cmsHTRANSFORM hXForm, TIFF* in, TIFF* o BufferIn + (j*BufSizeIn), BufSizeIn) < 0) goto cleanup; } + if (PixelCount < 0) + FatalError("TIFF is corrupted"); + cmsDoTransform(ContextID, hXForm, BufferIn, BufferOut, PixelCount); for (j=0; j < nPlanes; j++) { @@ -477,6 +488,9 @@ int StripBasedXform(cmsContext ContextID, cmsHTRANSFORM hXForm, TIFF* in, TIFF* PixelCount = (int) sw * (iml < sl ? iml : sl); iml -= sl; + if (PixelCount < 0) + FatalError("TIFF is corrupted"); + cmsDoTransform(ContextID, hXForm, BufferIn, BufferOut, PixelCount); for (j=0; j < nPlanes; j++) { @@ -1141,8 +1155,8 @@ int main(int argc, char* argv[]) TIFF *in, *out; - fprintf(stderr, "Little CMS ICC profile applier for TIFF - v6.3 [LittleCMS %2.2f]\n\n", LCMS_VERSION / 1000.0); - fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); + fprintf(stderr, "Little CMS ICC profile applier for TIFF - v6.4 [LittleCMS %2.2f]\n\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2021 Marti Maria Saguer. See COPYING file for details.\n"); fflush(stderr); ContextID = cmsCreateContext(NULL, NULL); |