GraphicsMagick: 4 new changesets
GraphicsMagick Commits <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.7640.1643302380.1940.graphicsmagick-commit@lists.sourceforge.net> |
changeset 296b31eea1bb in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=296b31eea1bb summary: Fix configure/build for heif when linking to a static build of libheif changeset dace3baa83fe in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=dace3baa83fe summary: JXL: Redone reader to handle more input files with different colorspaces changeset 21d3ad1a0dc2 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=21d3ad1a0dc2 summary: JXL: Ping mode don't need multiple threads changeset 603982ea5485 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=603982ea5485 summary: Merge default diffstat: ChangeLog | 26 ++ NEWS.txt | 65 ++++++ VisualMagick/installer/inc/version.isx | 4 +- coders/jp2.c | 238 +++++++++++++++++------ coders/jxl.c | 329 ++++++++++++++++++++++++-------- coders/miff.c | 38 +-- coders/mpc.c | 21 +- common.shi.in | 3 + configure | 6 +- configure.ac | 6 +- doc/options.imdoc | 2 +- magick/command.c | 21 +- magick/magick_config.h.in | 4 +- magick/version.h | 4 +- utilities/gm.1 | 5 +- utilities/tests/common.sh | 7 + utilities/tests/effects.tap | 118 +++++----- utilities/tests/hald-clut.tap | 12 +- utilities/tests/icc-transform.tap | 2 +- utilities/tests/montage.tap | 6 +- utilities/tests/preview.tap | 2 +- www/Changelog.html | 21 ++ www/NEWS.html | 227 ++++++++++++++-------- www/compare.html | 11 + www/gm.html | 11 + 25 files changed, 834 insertions(+), 355 deletions(-) diffs (truncated from 2373 to 500 lines): diff -r a45a3d5e77ae -r 603982ea5485 ChangeLog --- a/ChangeLog Sun Jan 16 14:46:19 2022 -0600 +++ b/ChangeLog Thu Jan 27 10:51:02 2022 -0600 @@ -1,3 +1,29 @@ +2022-01-23 Bob Friesenhahn <[email protected]> + + * coders/jp2.c (ReadJP2Image): Always use + ThrowJP2ReaderException(). Should address oss-fuzz Issue 43979: + "graphicsmagick:enhance_fuzzer: ASSERT: jas_get_ctx() == + jas_global.ctx". + +2022-01-22 Bob Friesenhahn <[email protected]> + + * utilities/tests: Write compressed MIFF files to reduce disk + space usage. + + * magick/command.c (CompareImageCommand): Support '-compress' + option. + + * coders/mpc.c: Fix warnings from GCC 11. + + * coders/miff.c: Fix warnings from GCC 11. + +2022-01-21 Bob Friesenhahn <[email protected]> + + * coders/jp2.c: Adaptations to work with Jasper 3.0.0's + jas_init_library() and other related functions. Add missing + jas_cleanup_thread(). Do not request a higher memory limit than + JasPer's own limit in order to avoid a warning. + 2022-01-16 Bob Friesenhahn <[email protected]> * coders/miff.c (ReadMIFFImage): Do not proceed to next image in diff -r a45a3d5e77ae -r 603982ea5485 NEWS.txt --- a/NEWS.txt Sun Jan 16 14:46:19 2022 -0600 +++ b/NEWS.txt Thu Jan 27 10:51:02 2022 -0600 @@ -19,6 +19,71 @@ .. contents:: :local: +1.3.38 (?? ??, 2022) +========================== + +Special Issues: + +* The FTP site ftp.graphicsmagick.org is now shut down due to a lack + of bandwith, extremely abusive users (including from Google and + customers of Amazon Web Services), and a lack of support from the + user community. Another factor is that FTP support has been removed + from popular web browsers. This is very unfortunate since the site + served multiple usages, including providing a lot of historical data + (e.g. related to PNG) which may not be available elsewhere. + +* GraphicsMagick really does need some additional productive + volunteers. For several years now, the burden has entirely been on + me (Bob Friesenhahn). I have been sheparding the project for 19 + years already (and contributed to ImageMagick and GraphicsMagick + combined for 25 years already). It is not reasonable to expect + someone with a full time job (and expecting to retire in a couple of + years) to do all of the work. + +Security Fixes: + +* GraphicsMagick is participating in Google's oss-fuzz project due to + the contributions and assistance of Alex Gaynor. Since February 4 + 2018, ??? issues have been opened by oss-fuzz and ?? issues remain + open (most of which are in third-party software such as development + JasPer). The issues list is available at + https://bugs.chromium.org/p/oss-fuzz/issues/list under search term + "graphicsmagick". Issues are available for anyone to view and + duplicate if they have been in "Verified" status for 30 days, or if + they have been in "New" status for 90 days. Please consult the + GraphicsMagick ChangeLog file, Mercurial repository commit log, and + the oss-fuzz issues list for details. + + +Bug fixes: + +* None + +New Features: + +* Added support for reading HEIF/HEIC format. + +API Updates: + +* None + +Feature improvements: + +* None + +Windows Delegate Updates/Additions: + +* None + +Build Changes: + +* None + +Behavior Changes: + +* None + + 1.3.37 (December 12, 2021) ========================== diff -r a45a3d5e77ae -r 603982ea5485 VisualMagick/installer/inc/version.isx --- a/VisualMagick/installer/inc/version.isx Sun Jan 16 14:46:19 2022 -0600 +++ b/VisualMagick/installer/inc/version.isx Thu Jan 27 10:51:02 2022 -0600 @@ -10,5 +10,5 @@ #define public MagickPackageName "GraphicsMagick" #define public MagickPackageVersion "1.4" -#define public MagickPackageVersionAddendum ".020220116" -#define public MagickPackageReleaseDate "snapshot-20220116" +#define public MagickPackageVersionAddendum ".020220123" +#define public MagickPackageReleaseDate "snapshot-20220123" diff -r a45a3d5e77ae -r 603982ea5485 coders/jp2.c --- a/coders/jp2.c Sun Jan 16 14:46:19 2022 -0600 +++ b/coders/jp2.c Thu Jan 27 10:51:02 2022 -0600 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003-2021 GraphicsMagick Group +% Copyright (C) 2003-2022 GraphicsMagick Group % Copyright (C) 2002 ImageMagick Studio % % This program is covered by multiple licenses, which are described in @@ -92,11 +92,21 @@ # undef HAVE_PGX_DECODE # endif +#if defined(HAVE_JAS_INIT_LIBRARY) +# define HAVE_JAS_STREAM_IO_V3 +#endif + #if 0 -/* Development JasPer 3.0.0 jas_initialize() is not yet ready for our purposes */ -#if !(defined(MAGICK_ENABLE_JAS_INITIALIZE) && MAGICK_ENABLE_JAS_INITIALIZE) -#undef HAVE_JAS_INITIALIZE -#endif /* if !defined(ENABLE_JAS_INITIALIZE) */ +/* Development JasPer 3.0.0 jas_init_library() is not yet ready for our purposes */ +#if !(defined(MAGICK_ENABLE_JAS_INIT_LIBRARY) && MAGICK_ENABLE_JAS_INIT_LIBRARY) +#undef HAVE_JAS_INIT_LIBRARY +#endif /* if !(defined(MAGICK_ENABLE_JAS_INIT_LIBRARY) && MAGICK_ENABLE_JAS_INIT_LIBRARY) */ +#endif + +#if defined(HAVE_PTHREAD) || defined(MSWINDOWS) || defined(HAVE_OPENMP) +# define JP2_HAVE_THREADS 1 +#else +# define JP2_HAVE_THREADS 0 #endif @@ -321,57 +331,66 @@ int (*read_)(jas_stream_obj_t *obj, char *buf, unsigned cnt); int (*write_)(jas_stream_obj_t *obj, const char *buf, unsigned cnt); + In Jasper 3.0.0 the interface changed again: + jas_ssize_t (*read_)(jas_stream_obj_t *obj, char *buf, size_t cnt); + jas_ssize_t (*write_)(jas_stream_obj_t *obj, const char *buf, size_t cnt); + We have yet to find a useful way to determine the version of the JasPer library using the C pre-processor. */ -#if !defined(MAGICK_JP2_OLD_STREAM_INTERFACE) -# define MAGICK_JP2_OLD_STREAM_INTERFACE 0 -#endif /* if !defined(MAGICK_JP2_OLD_STREAM_INTERFACE) */ -#if MAGICK_JP2_OLD_STREAM_INTERFACE -static int BlobRead(jas_stream_obj_t *object,char *buffer,const int length) +/* Read characters from a file object. */ +/* jas_ssize_t (*read_)(jas_stream_obj_t *obj, char *buf, size_t cnt); */ +#if defined(HAVE_JAS_STREAM_IO_V3) +static jas_ssize_t BlobRead(jas_stream_obj_t *obj, char *buf, size_t cnt) #else -static int BlobRead(jas_stream_obj_t *object,char *buffer,unsigned length) +static int BlobRead(jas_stream_obj_t *obj, char *buf, unsigned cnt) #endif { size_t count; StreamManager - *source = (StreamManager *) object; + *source = (StreamManager *) obj; - count=ReadBlob(source->image,(size_t) length,(void *) buffer); - return ((int) count); + count=ReadBlob(source->image,(size_t) cnt,(void *) buf); + return (count); } -#if MAGICK_JP2_OLD_STREAM_INTERFACE -static int BlobWrite(jas_stream_obj_t *object,char *buffer,const int length) +/* Write characters to a file object. */ +/* jas_ssize_t (*write_)(jas_stream_obj_t *obj, const char *buf, size_t cnt); */ +#if defined(HAVE_JAS_STREAM_IO_V3) +static jas_ssize_t BlobWrite(jas_stream_obj_t *obj, const char *buf, size_t cnt) #else -static int BlobWrite(jas_stream_obj_t *object,const char *buffer,unsigned length) +static int BlobWrite(jas_stream_obj_t *obj, const char *buf, unsigned cnt) #endif { size_t count; StreamManager - *source = (StreamManager *) object; + *source = (StreamManager *) obj; - count=WriteBlob(source->image,(size_t) length,(void *) buffer); - return((int) count); + count=WriteBlob(source->image,(size_t) cnt,(void *) buf); + return(count); } -static long BlobSeek(jas_stream_obj_t *object,long offset,int origin) +/* Set the position for a file object. */ +/* long (*seek_)(jas_stream_obj_t *obj, long offset, int origin); */ +static long BlobSeek(jas_stream_obj_t *obj,long offset,int origin) { StreamManager - *source = (StreamManager *) object; + *source = (StreamManager *) obj; return (SeekBlob(source->image,offset,origin)); } -static int BlobClose(jas_stream_obj_t *object) +/* Close a file object. */ +/* int (*close_)(jas_stream_obj_t *obj); */ +static int BlobClose(jas_stream_obj_t *obj) { StreamManager - *source = (StreamManager *) object; + *source = (StreamManager *) obj; CloseBlob(source->image); jas_free(source); @@ -395,6 +414,8 @@ stream->obj_=(jas_stream_obj_t *) jas_malloc(sizeof(StreamManager)); if (stream->obj_ == (jas_stream_obj_t *) NULL) { + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + "jas_malloc() failed!"); jas_free(stream); return((jas_stream_t *) NULL); } @@ -410,24 +431,37 @@ return(stream); } -#define ThrowJP2ReaderException(code_,reason_,image_) \ -{ \ - for (component=0; component < (long) number_components; component++) \ - MagickFreeResourceLimitedMemory(channel_lut[component]); \ - if (pixels) \ - jas_matrix_destroy(pixels); \ - if (jp2_stream) \ - (void) jas_stream_close(jp2_stream); \ - if (jp2_image) \ - jas_image_destroy(jp2_image); \ - MagickFreeMemory(options); \ - ThrowReaderException(code_,reason_,image_); \ -} +#if defined(HAVE_JAS_INIT_LIBRARY) +# define JAS_CLEANUP_THREAD() jas_cleanup_thread() +#else +# define JAS_CLEANUP_THREAD() +#endif + +#define ThrowJP2ReaderException(code_,reason_,image_) \ + { \ + for (component=0; component < (long) number_components; component++) \ + MagickFreeResourceLimitedMemory(channel_lut[component]); \ + if (pixels) \ + jas_matrix_destroy(pixels); \ + if (jp2_stream) \ + (void) jas_stream_close(jp2_stream); \ + if (jp2_image) \ + jas_image_destroy(jp2_image); \ + MagickFreeMemory(options); \ + JAS_CLEANUP_THREAD(); \ + ThrowReaderException(code_,reason_,image_); \ + } + +#define ThrowJP2WriterException(code_,reason_,image_) \ + { \ + JAS_CLEANUP_THREAD(); \ + ThrowWriterException(code_,reason_,image_); \ + } /* Initialize Jasper */ -#if HAVE_JAS_INITIALIZE +#if HAVE_JAS_INIT_LIBRARY static void *alloc_rlm(struct jas_allocator_s *allocator, size_t size) { char *p; @@ -452,18 +486,24 @@ /* fprintf(stderr,"realloc_rlm(%p, %p, %zu) -> %p\n", allocator, pointer, new_size, p); */ return p; } -#endif /* if HAVE_JAS_INITIALIZE */ -static void initialize_jasper(void) +#endif /* if HAVE_JAS_INIT_LIBRARY */ +static MagickPassFail initialize_jasper(ExceptionInfo *exception) { + (void) exception; if (!jasper_initialized) { -#if HAVE_JAS_INITIALIZE +#if HAVE_JAS_INIT_LIBRARY { /* static jas_std_allocator_t allocator; */ static jas_allocator_t allocator; + (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Initializing JasPer..."); + /* + Configure the library using the default configuration settings. + */ jas_conf_clear(); + /* Provide our own resource-limited memory allocation functions. @@ -503,11 +543,29 @@ /* Tell JasPer how much memory it could ever be allowed to use. */ - jas_conf_set_max_mem((size_t) GetMagickResourceLimit(MemoryResource)); + { + size_t max_mem_gm = (size_t) GetMagickResourceLimit(MemoryResource); + size_t max_mem_jas = jas_get_total_mem_size(); + if (max_mem_jas == 0) + max_mem_jas=max_mem_gm; + jas_conf_set_max_mem_usage(Min(max_mem_jas,max_mem_gm)); + } - if (jas_initialize() == 0) + /* + Inform JasPer that app may be multi-threaded + */ + jas_conf_set_multithread(JP2_HAVE_THREADS); + + /* Perform global initialization for the JasPer library. */ + if (jas_init_library() == 0) { jasper_initialized=MagickTrue; + /* jas_set_debug_level(110); */ + } + else + { + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + "jas_init_library() failed!"); } } #else @@ -520,8 +578,13 @@ (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Initialized JasPer"); } + else + { + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + "jas_init() failed!"); + } } -#endif /* HAVE_JAS_INITIALIZE */ +#endif /* HAVE_JAS_INIT_LIBRARY */ if (!jasper_initialized) { @@ -529,6 +592,8 @@ "Failed to initialize JasPer!"); } } + + return jasper_initialized ? MagickPass : MagickFail; } @@ -541,9 +606,12 @@ { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Destroying JasPer..."); -#if HAVE_JAS_INITIALIZE +#if HAVE_JAS_INIT_LIBRARY + /* Perform global cleanup for the JasPer library. */ + jas_cleanup_library(); +#else jas_cleanup(); -#endif /* if HAVE_JAS_INITIALIZE */ +#endif /* if HAVE_JAS_INIT_LIBRARY */ jasper_initialized=MagickFalse; } } @@ -607,7 +675,23 @@ /* Initialize Jasper */ - initialize_jasper(); + if (initialize_jasper(exception) != MagickPass) + { + return (Image *) NULL; + } + +#if HAVE_JAS_INIT_LIBRARY + /* + Perform any per-thread initialization for the JasPer library. + */ + if (jas_init_thread()) + { + /* Handle the initialization error. */ + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + "jas_init_thread() failed!"); + return (Image *) NULL; + } +#endif /* if HAVE_JAS_INIT_LIBRARY */ /* Open image file. @@ -620,7 +704,7 @@ image=AllocateImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == False) - ThrowReaderException(FileOpenError,UnableToOpenFile,image); + ThrowJP2ReaderException(FileOpenError,UnableToOpenFile,image); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Requested format is \"%s\"", @@ -645,14 +729,13 @@ /* Read header */ if ((magick_length=ReadBlob(image,sizeof(magick),magick)) != sizeof(magick)) { - ThrowReaderException(CorruptImageError,UnexpectedEndOfFile, - image); + ThrowJP2ReaderException(CorruptImageError,UnexpectedEndOfFile,image); } /* Restore seek position */ if (SeekBlob(image,pos,SEEK_SET) != pos) { - ThrowReaderException(BlobError,UnableToSeekToOffset,image); + ThrowJP2ReaderException(BlobError,UnableToSeekToOffset,image); } /* Inspect header to see what it might actually be */ @@ -671,7 +754,7 @@ { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Not a \"%s\" file!", image_info->magick); - ThrowReaderException(CorruptImageError,ImproperImageHeader,image); + ThrowJP2ReaderException(CorruptImageError,ImproperImageHeader,image); } /* @@ -681,7 +764,7 @@ { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Header is not a supported type for this coder"); - ThrowReaderException(CorruptImageError,ImproperImageHeader,image); + ThrowJP2ReaderException(CorruptImageError,ImproperImageHeader,image); } /* @@ -691,7 +774,7 @@ (const MagickInfo *) NULL) || (magick_info->decoder == (DecoderHandler) NULL)) { - ThrowReaderException(DelegateError,UnableToDecodeImageFile,image); + ThrowJP2ReaderException(DelegateError,UnableToDecodeImageFile,image); } } @@ -700,7 +783,7 @@ */ jp2_stream=JP2StreamManager(&StreamOperators, image); if (jp2_stream == (jas_stream_t *) NULL) - ThrowReaderException(DelegateError,UnableToManageJP2Stream,image); + ThrowJP2ReaderException(DelegateError,UnableToManageJP2Stream,image); /* Support passing Jasper options. @@ -905,6 +988,10 @@ { (void) jas_stream_close(jp2_stream); jas_image_destroy(jp2_image); +#if HAVE_JAS_INIT_LIBRARY + /* Perform any per-thread clean-up for the JasPer library. */ + JAS_CLEANUP_THREAD(); +#endif /* if HAVE_JAS_INIT_LIBRARY */ return(image); } @@ -1065,6 +1152,10 @@