GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

2018-02-23 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/bmp.c (ReadBMPImage): Fix SeekBlob() return value checks. Add more EOF checks. Require that a provided ba_offset be a forward seek in order to avoid the possibility of endless looping.

2018-02-23 Fojtik Jaroslav <JaFojtik@seznam.cz>

> - coders/mat.c Fix oss-fuzz issue 6301. (Credit to OSS-Fuzz)

2018-02-22 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/alpha_composite.c (BlendQuantumOpacity): The pixel compositing equation used when compositing an image into the output was incorrect and has been fixed.
> - magick/render.c (DrawPolygonPrimitive): When compositing polygon edge pixels over a transparent black background, the code would composite as if the background were opaque black, resulting in the edge pixels being too dark (fixed).

2018-02-21 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (DrawImage): Per the SVG spec, opacity, fill-opacity, and stroke-opacity values are now clamped to [0,1].

>   Also fixed two bugs introduced by changeset 91de8039f27d (dated 2018-02-12): (1) a group/object opacity value specified using a percentage was not being converted to a value in [0,1]; (2) if fill-opacity or stroke-opacity was 1, and the group/object opacity value was set to 1, the resulting fill-opacity or stroke-opacity value would be set to 0 instead of 1.

2018-02-19 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/viff.c (ReadVIFFImage): Fix excessive memory usage. Fixes oss-fuzz 6006 "graphicsmagick/coder_XV_fuzzer: Out-of-memory in graphicsmagick_coder_XV_fuzzer". (Credit to OSS-Fuzz)
> - coders/txt.c (ReadInt): Avoid benign signed integer overflow due to accepting an arbitrary number of digits. Fixes oss-fuzz 6002 "graphicsmagick/coder_TEXT_fuzzer: Integer-overflow in ReadInt". (Credit to OSS-Fuzz)
> - coders/viff.c (ReadVIFFImage): Verify that there is sufficient data to back up colormap allocation request. Fixes oss-fuzz 5986 "graphicsmagick/coder_VIFF_fuzzer: Out-of-memory in graphicsmagick_coder_VIFF_fuzzer". (Credit to OSS-Fuzz)
> - magick/memory.c: Define MAGICK_MEMORY_HARD_LIMIT=value to abort when memory request exceeds value. Useful to find location of excessive memory requests.

2018-02-19 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - coders/svg.c (SVGStartElement): Per the SVG spec, the SVG coder now initializes the MVG coder (which renders SVG graphical elements) with the the SVG defaults for fill color, fill-opacity, stroke color, stroke-opacity, and stroke-width. This makes the SVG coder independent of the MVG coder intial state.

2018-02-19 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - coders/svg.c (SVGStartElement): Fixed initialization of x and y attributes per the SVG spec: for graphical elements "image", "pattern", "text", "rect", and "use", if the x or y attribute is not specified, the effect is as if a value of "0" were specified.

2018-02-18 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/sun.c (ReadSUNImage): Fix edge case which broke file-size validation logic. Fixes oss-fuzz issue 5981 "graphicsmagick/coder_SUN_fuzzer: Out-of-memory in graphicsmagick_coder_SUN_fuzzer". (Credit to OSS-Fuzz)
> - coders/txt.c (ReadTXTImage): Validate that file size is sufficient for claimed image properties. Fixes oss-fuzz issue 5960 "graphicsmagick/coder_TXT_fuzzer: Out-of-memory in graphicsmagick_coder_TXT_fuzzer". (Credit to OSS-Fuzz)
> - coders/tga.c (ReadTGAImage): Only allow 1 and 8 bit colormapped/grey images. Fixes oss-fuzz issue 6314 "graphicsmagick/coder_ICB_fuzzer: Undefined-shift in ReadTGAImage". (Credit to OSS-Fuzz)
> - coders/bmp.c (ReadBMPImage): Detect and report when BMP height value is out of range (too negative). Fixes oss-fuzz issue 6394 "graphicsmagick/coder_BMP_fuzzer: Integer-overflow in ReadBMPImage". (Credit to OSS-Fuzz)
> - coders/rla.c (ReadRLAImage): Detect when RLE decoding is producing too many samples and report as an error. Fixes oss-fuzz issue 6312 "graphicsmagick/coder_RLA_fuzzer: Timeout in graphicsmagick_coder_RLA_fuzzer". (Credit to OSS-Fuzz)
> - coders/fits.c (ReadFITSImage): Validate that file size is sufficient for claimed image properties. Fixes oss-fuzz issue 6429 "graphicsmagick/coder_FITS_fuzzer: Timeout in graphicsmagick_coder_FITS_fuzzer". (Credit to OSS-Fuzz)
> - magick/image.c (CloneImage): Check image pixel limits in CloneImage() when it is used to change the image dimensions. This avoids depending on the using code to detect and report such issues.
> - coders/xcf.c (ReadXCFImage): Check image pixel limits after each CloneImage() to assure that image is within specified resource limits. Fixes oss-fuzz issue 6399 "graphicsmagick/enhance_fuzzer: Timeout in graphicsmagick_enhance_fuzzer". (Credit to OSS-Fuzz)

2018-02-16 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (TracePath): TracePath() was not correctly processing multiple sets of cubic or quadratic Bezier coordinates when the previous path data command was not a cubic or quadratic Bezier command. This would result in the first control point being equal to the current path point instead of being computed using the current path point and the second control point of the previous Bezier command.

2018-02-15 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (TracePath): TracePath() was not consuming commas (if present) at the end of a set of points when multiple sets of points were specified for various path commands (e.g., line, Bezier). This resulted in the remaining sets of points being ignored (fixed).

2018-02-15 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (TraceArcPath): No points are generated by TraceArcPath() if the starting and ending arc points are the same. For this case, the coordinate count was not being set to zero before returning (fixed).

2018-02-15 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (DrawImage): Clipping of polygons in DrawImage() would sometime result in a starting pixel location that was greater than the ending pixel location, causing a subsequent call to GetImagePixelsEx() to fail due a column count <= 0. Modified the clipping code to eliminate this condition, and also to return early if the polygon lies completely outside the image boundaries. Also fixed variable declarations from a previous commit that were causing problems for the C89 compiler.

2018-02-13 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/topol.c (ReadTOPOLImage): Detect EOF immediately rather than spinning. Fixes oss-fuzz issue 6303 "graphicsmagick/coder_TOPOL_fuzzer: Timeout in graphicsmagick_coder_TOPOL_fuzzer". (Credit to OSS-Fuzz)
> - coders/dcm.c (DCM_SetupRescaleMap): Avoid excessive left shift. Fixes oss-fuzz issue 6256 "graphicsmagick/coder_DCM_fuzzer: Undefined-shift in DCM_SetupRescaleMap". (Credit to OSS-Fuzz)

2018-02-12 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/wpg.c (ExtractPostscript): Detect EOF on input while transferring bytes to Postscript file. Fixes oss-fuzz issue 6087 "graphicsmagick/coder_WPG_fuzzer: NULL". Later identified to be CVE-2017-1768 as previously discovered in ImageMagick. (Credit to OSS-Fuzz)
> - coders/pdb.c (ReadPDBImage): Quit attempting to read image data immediately at EOF. Fixes oss-fuzz issue 6252 "graphicsmagick/coder_PDB_fuzzer: Timeout in graphicsmagick_coder_PDB_fuzzer". (Credit to OSS-Fuzz)

2018-02-12 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/topol.c (ReadTOPOLImage): Avoid index out of bounds when input filename does not use a file extension. Fixes oss-fuzz issue 6237 "graphicsmagick/coder_TOPOL_fuzzer: Index-out-of-bounds in ReadTOPOLImage". (Credit to OSS-Fuzz)

2018-02-12 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (DrawImage): Object/group opacity, when set in DrawImage(), would overwrite the fill and stroke opacities. This has been fixed so that the object opacity is now combined with the fill and stroke opacities per the SVG spec.

2018-02-12 Fojtik Jaroslav <JaFojtik@seznam.cz>

> - coders/mat.c Fix oss-fuzz issue 6021. (Credit to OSS-Fuzz)

2018-02-11 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/dcm.c (ReadDCMImage): Avoid undefined left shift of short. Fix memory leaks in error reporting paths. Fixes oss-fuzz issue 6217 "graphicsmagick/coder_DCM_fuzzer: Undefined-shift in ReadDCMImage". (Credit to OSS-Fuzz)
> - coders/dpx.c (ReadDPXImage): Avoid divide by zero exception in the case where reference high equals reference low. Fixes oss-fuzz issue 6215 "graphicsmagick/coder_DPX_fuzzer: Divide-by-zero in ReadDPXImage". (Credit to OSS-Fuzz)
> - coders/topol.c (ReadTOPOLImage): Avoid index out of bounds when input filename does not use a file extension.
> - coders/cut.c (ReadCUTImage): Avoid index out of bounds when input filename does not use a file extension. Fixes oss-fuzz issue 6218 "graphicsmagick/coder_CUT_fuzzer: Index-out-of-bounds in ReadCUTImage". (Credit to OSS-Fuzz)
> - coders/pwp.c (ReadPWPImage): Force temporary file to be read as a SFW file rather than autodetecting the format. Fixes oss-fuzz issue 6220 "graphicsmagick/coder_PWP_fuzzer: Indirect-leak in AllocateImage". (Credit to OSS-Fuzz)

2018-02-10 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/pdf.c (WritePDFImage): Assure that xref memory is not leaked if an exception is thrown. Fixes oss-fuzz issue 5968 "graphicsmagick/coder_EPDF_fuzzer: Direct-leak in MagickRealloc". (Credit to OSS-Fuzz)
> - coders/tim.c (ReadTIMImage): Verify that 4/8 bit PSX TIM provides a CLUT and verify indexes. Fixes oss-fuzz issue 5972 "graphicsmagick/coder_TIM_fuzzer: Null-dereference WRITE in ReadTIMImage". (Credit to OSS-Fuzz)
> - coders/topol.c (ReadTOPOLImage): Add additional header validations. Fixes oss-fuzz issue 5975 "graphicsmagick/coder_TOPOL_fuzzer: Floating-point-exception in ReadTOPOLImage". (Credit to OSS-Fuzz)
> - coders/bmp.c (ReadBMPImage): Avoid possible division by zero when decoding CIE primary values. (Credit to OSS-Fuzz)
> - magick/export.c (ExportViewPixelArea): Only compute unsigned_maxvalue if sample_bits <= 32.
> - magick/import.c (ImportViewPixelArea): Assure that double_maxvalue minus double_minvalue is not zero, or excessively close to zero to avoid divide by zero exception or impossible scaling factor. (Credit to OSS-Fuzz) (ImportViewPixelArea): Only compute unsigned_maxvalue if sample_bits <= 32.

2018-02-09 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/dib.c (ReadDIBImage): Validate that image width is not too negative such that it's absolute value can not fit in 32-bit unsigned width. Resolves oss-fuzz issue 6179 "graphicsmagick/coder_ICO_fuzzer: Integer-overflow in ReadDIBImage". (Credit to OSS-Fuzz)
> - coders/dcm.c (funcDCM_BitsStored): Validate DICOM datum size. Use a different means to determine the maximum value which does not use excessive shifting. Resolves oss-fuzz issue 6165 "graphicsmagick/coder_DCM_fuzzer: Undefined-shift in funcDCM_BitsStored". (Credit to OSS-Fuzz)

2018-02-08 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/dpx.c (ReadWordU32BE): Add casts to avoid default type promotion from unsigned char to 'int' leading to undefined behavior for 24 bit shift. Fixes oss-fuzz issue 6058 "graphicsmagick/coder_DPX_fuzzer: Undefined-shift in ReadWordU32BE". (Credit to OSS-Fuzz) (ReadDPXImage): Require that the file has at least one element. Add bountiful casts for values which are left-shifted. Fixes oss-fuzz issue 5962 "graphicsmagick/coder_DPX_fuzzer: Undefined-shift in ReadDPXImage". (Credit to OSS-Fuzz)
> - coders/dcm.c (DCM_ReadOffsetTable): Add casts Add casts to avoid default type promotion from unsigned char to 'int' leading to undefined behavior for 16 bit shift. Fixes oss-fuzz issue 5980 "graphicsmagick/coder_DCM_fuzzer: Undefined-shift in DCM_ReadOffsetTable". (Credit to OSS-Fuzz)
> - magick/module_aliases.h (ModuleAliases): Add missing mapping from "ICODIB" format to "DIB" module.
> - magick/import.c (ImportUInt32Quantum): Add casts to avoid default type promotion from unsigned char to 'int' leading to undefined behavior for 24 bit shift. Fixes oss-fuzz "graphicsmagick/coder_P7_fuzzer: Undefined-shift in ImportRGBQuantumType". (Credit to OSS-Fuzz)

2018-02-07 Fojtik Jaroslav <JaFojtik@seznam.cz>

> - coders/wpg.c Fix oss-fuzz issue 5964 "graphicsmagick/coder_MAT_fuzzer: Heap-use-after-free in GetLocaleExceptionMessage". (Credit to OSS-Fuzz)

2018-02-07 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/render.c (IsPoint): Fixed a bug in which IsPoint() would reject as a valid coordinate value strings that did not begin with an integer: e.g., "0.25" would be accepted, but ".25" would not.

2018-02-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/cut.c (ReadCUTImage): Fix DestroyImageInfo() of NULL pointer leading to assertion. Fixes oss-fuzz issue 6067 "graphicsmagick/coder_CUT_fuzzer: Unknown signal in DestroyImageInfo".
> - coders/tga.c (ReadTGAImage): Throw exception rather than assertion for unexpected comment size. Fixes oss-fuzz issue 5961 "graphicsmagick/coder_ICB_fuzzer: ASSERT: (size_t) (tga_info.id_length+1) == commentsize".

2018-02-06 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/pdf.c (WritePDFImage): Free 'xref' allocation before error return. Fixes oss-fuzz issue 5968 "graphicsmagick/coder_EPDF_fuzzer: Direct-leak in MagickRealloc".

2018-02-04 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/pdb.c (ReadPDBImage): Fix heap buffer overflow if blob is already at EOF when comment is read. Fixes oss-fuzz issue 5997 "graphicsmagick/coder_PDB_fuzzer: Heap-buffer-overflow in SetImageAttribute".
> - coders/dpx.c (ReadDPXImage): Fix memory leak of user data if user data is truncated. Fix consumption of one uninitialized stack bytes. Fixes oss-fuzz issue 5973: graphicsmagick/enhance_fuzzer: Direct-leak in ReadDPXImage.
> - coders/pnm.c (ReadPNMImage): Detect and avoid division by zero. Fixes Issue 5959 in oss-fuzz: graphicsmagick/coder_P7_fuzzer: Divide-by-zero in ReadPNMImage
> - magick/xwindow.c (MagickXClientMessage): Eliminate valgrind gripe about use of uninitialized stack data by clearing allocation to zero. (MagickXMakeImage): Eliminate valgrind gripe about use of uninitialized heap data by clearing allocation to zero.
> - coders/pwp.c (ReadPWPImage): Remove bogus EOF test on an image with a closed blob. Fixes Issue 5957 in oss-fuzz: graphicsmagick/coder_PWP_fuzzer: ASSERT: image->blob->type != UndefinedStream.
> - www/Changes.rst: Fix typo with spelling "ChangeLog-2017.html". Resolves SourceForge issue #544 "dead link 2017 changelog page on GraphicsMagick web site".

2018-02-03 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - magick/static.c (OpenModule): Assure that status is initialized. Resolves Coverity 261207 "Uninitialized scalar variable".
> - wand/magick_wand.c (MagickHasColormap): New function to test if the image has a colormap. (MagickIsGrayImage): New function to test if the image uses only gray pixels. (MagickIsMonochromeImage): New function to test if the image uses only monochrome pixels. (MagickIsOpaqueImage): New function to test if the image uses only opaque pixels. (MagickIsPaletteImage): New function to test if the image is based on a color palette. Above functions are written by Troy Patteson and submitted via SourceForge patch #54 "Wand API patches: has colormap, is gray image, is monochrome image, is opaque image, is palette image".
> - fuzzing: Added initial OSS-Fuzz integration by Alex Gaynor. From SourceForge patch #55 "OSS-Fuzz integration"
> - coders/png.c (ReadMNGImage): Fix free using possibly unallocated pointer value.
> - magick/blob.c (SeekBlob): Remove implicit extension of blob allocation size based on seek offset. Besides making an assumption about how the blob memory was allocated, this reallocation feature provides a memory DOS opportunity. Resolves issue reported by Alex Gaynor via email entitled "Security issue with memory management in Magick++" to the graphicsmagick-security list on 31 Jan 2018. (SeekBlob):
> - coders/jpeg.c (ReadIPTCProfile): Revert inadvertent wrong return codes added by change on December 9, 2017. Fixes SourceForge bug 542 "Improper call to JPEG library in state 201" since 1.3.28.

2018-02-01 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/annotate.c (RenderFreetype): Fixed the text opacity computation in RenderFreeType(). This bug caused the text fill color to bleed into the character cell when the SVG "fill-opacity" is less than 1.0.

2018-02-01 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - magick/attribute.c (CloneImageAttributes): Fixed a bug in which the source image attributes would always replace the destination image attributes instead of being appended to them, and the destination image attributes would become a memory leak.

2018-01-31 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - coders/svg.c (SVGStartElement): Fixed a bug in which the x,y location values for a <text> or <tspan> were overwritten by the x,y values for the next <tspan> before the previous values were used. This caused the text associated with the previous <text> or <tspan> to appear at the location specified for the next <tspan>.

2018-01-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - magick/static.c: Use !defined(SupportMagickModules) to enable static module loader. Fixes SourceForge bug #543 "Multiple definition of "OpenModule" (etc) when cross-compiling shared".

2018-01-29 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - coders/svg.c (SVGStartElement): A terminating '>' in a geometry string is interpreted to mean that the dimensions of an image should only be changed if its width or height exceeds the geometry specification. For an unapparent and undocumented reason, a terminating '>', if present, was being nulled out, making this feature unusable for SVG files (now fixed).

2018-01-29 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - coders/svg.c (ReadSVGImage): If there is a geometry string in image_info->size (e.g., gm convert -size "50x50%" in.svg out.png), AllocateImage() sets image->columns and image->rows to the width and height values from the size string. However, this makes no sense if the size string was something like "50x50%" (we'll get columns = rows = 50). So we set columns and rows to 0 after AllocateImage(), which is the same as if no size string was supplied by the client. This also results in svg_info.bounds to be set to 0,0 (i.e., unknown), so that svg_info.bounds will later be set using the image size information from either the svg "canvas" width/height or from the viewbox. Later, variable "page" is set from svg_info->bounds. Then the geometry string in image_info->size gets applied to the (now known) "page" width and height when SvgStartElement() calls GetMagickGeometry(), and the intended result is obtained.

2018-01-24 Greg Wolfe <gregory.wolfe@kodakalaris.com>

> - coders/svg.c (SVGStartElement): When the density (DPI) is specified using the ImageInfo::density member, the derived scale factor is incorrectly applied a second time to the width and height members of variable RectangleInfo page. Fixes SourceForge ticket #451.

2018-01-23 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - magick/static.c: Use a lazy-loader for static modules with the same external interface as the lazy-loader for dynamic modules.

2018-01-20 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - NEWS.txt: Prepare for 1.3.28 release.

2018-01-17 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - NEWS.txt: Update with changes since previous release.

2018-01-14 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - PerlMagick/Magick.xs: Compiler warnings reduction.
> - magick/pixel_cache.h: Mark GetPixels(), GetIndexes(), and GetOnePixel() as deprecated. Compilers may produce a warning if these functions are used.
> - magick/pixel_cache.c (InterpolateColor): Return black pixel if InterpolateViewColor() reports failure.
> - coders/png.c (ReadMNGImage): Fix memory leak of chunk and mng_info in error path.
> - coders/gif.c (ReadGIFImage): Fix memory leak of global colormap.

2018-01-13 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - magick/symbols.h: Fix SourceForge issue #538 "13 symbols in common with ImageMagick despite --enable-symbol-prefix".
> - coders/bmp.c (ReadBMPImage): Fix non-terminal loop due to unexpected bit-field mask value. Fixes SourceForge issue #541 "Infinite Loop in ReadBMPImage (coders/bmp.c)".
> - coders/jpeg.c (JPEGMessageHandler): Revert code added on 2017-07-08 to promote certain warnings from libjpeg to errors. Add code to rationalize claimed image dimensions based on file size. Resolves SourceForge issue #539 "Images with libjpeg warnings result in error".

2018-01-11 Fojtik Jaroslav <JaFojtik@seznam.cz>

> - coders/wpg.c Recursive ReadImage could return multiple scenes
>     fixed.

2018-01-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - coders/png.c (ReadOnePNGImage): Quit 'passes' loop if we encountered an error
> - magick/pixel_cache.c (SetNexus): Fix heap overwrite in AcquireCacheNexus() due to SetNexus() not using an allocated staging area for the pixels like it should. This problem impacts all 1.3.X releases. Resolves SourceForge issues 532 "heap-buffer-overflow bug in ReadWPGImage" and #531 "heap-buffer-overflow in AcquireCacheNexus".
> - magick/pixel_cache.c (InterpolateViewColor): Now returns MagickPassFail rather than void. Code using this function is updated to check the return status.

2018-01-01 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - magick/describe.c (DescribeImage): Discriminate between AcquireImagePixels() returning NULL or finding a transparent pixel. This avoids use of a null pointer in the case where AcquireImagePixels() returns NULL.

2017-12-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - magick/static.c: Change static module initialization to be based on an initialized list rather than a squence of function calls in order to simplify maintenance and possibly address future requirements.

2017-12-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

> - Copyright.txt: Bump copyright years and rotate ChangeLog.