GraphicsMagick: 3 new changesets
GraphicsMagick Commits <[email protected]> Sat, 13 Jul 2024 18:16:10 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.475.1720912584.8001.graphicsmagick-commit@lists.sourceforge.net> |
changeset 15b0abacbd5e in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=3Dchangeset;nod= e=3D15b0abacbd5e summary: DrawGetStrokeDashArray(): Avoid integer underflow in loop. changeset 671c42ca3a4d in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=3Dchangeset;nod= e=3D671c42ca3a4d summary: Fix two Coverity "Overflowed constant" issues changeset 7695ab54cee1 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=3Dchangeset;nod= e=3D7695ab54cee1 summary: Fix three issues found by clang scan-build. diffstat: ChangeLog | 26 + Makefile.am | 4 +- Makefile.in | 5 +- VisualMagick/installer/inc/version.isx | 4 +- magick/analyze.c | 6 +- magick/command.c | 7 +- magick/delegate.c | 9 +- magick/display.c | 8 +- magick/draw.c | 33 +- magick/image.c | 5 +- magick/version.h | 4 +- wand/drawing_wand.c | 30 +- www/ChangeLog.html | 34 +- www/api/display.html | 30 +- www/api/draw.html | 1364 +++++++++++++++------------= --- www/api/image.html | 438 +++++----- www/wand/drawing_wand.html | 1374 ++++++++++++++++-----------= ----- 17 files changed, 1724 insertions(+), 1657 deletions(-) diffs (truncated from 6421 to 500 lines): diff -r 89e12551753e -r 7695ab54cee1 ChangeLog --- a/ChangeLog Sun Jul 07 17:54:29 2024 -0500 +++ b/ChangeLog Sat Jul 13 18:15:14 2024 -0500 @@ -1,3 +1,29 @@ +2024-07-13 Bob Friesenhahn <[email protected]> + + * magick/display.c (MagickXROIImage): Fix clang-analyzer issue. + + * magick/delegate.c (ListDelegateInfo): Fix clang-analyzer issue. + + * magick/command.c (TimeImageCommand): Fix clang-analyzer issue. + +2024-07-09 Bob Friesenhahn <[email protected]> + + * magick/image.c (MagickParseSubImageSpecification): Quiet + Coverity 427451 "Overflowed constant". + + * magick/analyze.c (MinimumDepthForValue): Fix loop bounds and + avoid overflow of the return value. Addresses Coverity 427448 + "Overflowed constant". + +2024-07-08 Bob Friesenhahn <[email protected]> + + * wand/drawing_wand.c (DrawGetStrokeDashArray): Avoid integer + underflow in loop. Addresses Coverity 427450 "Overflowed + constant." + + * magick/draw.c (DrawGetStrokeDashArray): Avoid integer underflow + in loop. Addresses Coverity 427460 "Overflowed constant". + 2024-07-07 Bob Friesenhahn <[email protected]> = * coders/tiff.c (InitializeImageColormap): Verify that diff -r 89e12551753e -r 7695ab54cee1 Makefile.am --- a/Makefile.am Sun Jul 07 17:54:29 2024 -0500 +++ b/Makefile.am Sat Jul 13 18:15:14 2024 -0500 @@ -491,8 +491,8 @@ # The project should have been configured to use clang. # -enable-checker security.insecureAPI.DeprecatedOrUnsafeBufferHandling scan-build: - scan-build-13 -k --html-title=3D'GraphicsMagick' \ - -maxloop 1000 \ + scan-build-15 -k --html-title=3D'GraphicsMagick' \ + -maxloop 10000 \ -disable-checker deadcode.DeadStores \ -enable-checker security.insecureAPI.bcmp \ -enable-checker security.insecureAPI.bcopy \ diff -r 89e12551753e -r 7695ab54cee1 Makefile.in --- a/Makefile.in Sun Jul 07 17:54:29 2024 -0500 +++ b/Makefile.in Sat Jul 13 18:15:14 2024 -0500 @@ -2774,6 +2774,7 @@ prefix =3D @prefix@ program_transform_name =3D @program_transform_name@ psdir =3D @psdir@ +runstatedir =3D @runstatedir@ sbindir =3D @sbindir@ sharedstatedir =3D @sharedstatedir@ srcdir =3D @srcdir@ @@ -11682,8 +11683,8 @@ # The project should have been configured to use clang. # -enable-checker security.insecureAPI.DeprecatedOrUnsafeBufferHandling scan-build: - scan-build-13 -k --html-title=3D'GraphicsMagick' \ - -maxloop 1000 \ + scan-build-15 -k --html-title=3D'GraphicsMagick' \ + -maxloop 10000 \ -disable-checker deadcode.DeadStores \ -enable-checker security.insecureAPI.bcmp \ -enable-checker security.insecureAPI.bcopy \ diff -r 89e12551753e -r 7695ab54cee1 VisualMagick/installer/inc/version.isx --- a/VisualMagick/installer/inc/version.isx Sun Jul 07 17:54:29 2024 -0500 +++ b/VisualMagick/installer/inc/version.isx Sat Jul 13 18:15:14 2024 -0500 @@ -10,5 +10,5 @@ = #define public MagickPackageName "GraphicsMagick" #define public MagickPackageVersion "1.4" -#define public MagickPackageVersionAddendum ".020240707" -#define public MagickPackageReleaseDate "snapshot-20240707" +#define public MagickPackageVersionAddendum ".020240713" +#define public MagickPackageReleaseDate "snapshot-20240713" diff -r 89e12551753e -r 7695ab54cee1 magick/analyze.c --- a/magick/analyze.c Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/analyze.c Sat Jul 13 18:15:14 2024 -0500 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003 - 2022 GraphicsMagick Group +% Copyright (C) 2003 - 2024 GraphicsMagick Group % Copyright (C) 2003 ImageMagick Studio % Copyright 1991-1999 E. I. du Pont de Nemours and Company % @@ -301,14 +301,14 @@ depth, scale; = - for (depth=3D1 ; depth < MaxRGB; depth++) + for (depth=3D1 ; depth <=3D (unsigned int) QuantumDepth; depth++) { scale=3DMaxRGB / (MaxRGB >> (QuantumDepth-depth)); if (quantum =3D=3D scale*(quantum/scale)) break; } = - return depth; + return (unsigned char) depth; } static magick_uint8_t* AllocateDepthMap(void) { diff -r 89e12551753e -r 7695ab54cee1 magick/command.c --- a/magick/command.c Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/command.c Sat Jul 13 18:15:14 2024 -0500 @@ -17074,8 +17074,11 @@ (void) fflush(stdout); = screen_width=3D0; - if (getenv("COLUMNS")) - screen_width=3DMagickAtoI(getenv("COLUMNS"))-1; + { + const char * const columns_env =3D getenv("COLUMNS"); + if (columns_env) + screen_width=3DMagickAtoI(columns_env)-1; + } if (screen_width < 80) screen_width=3D80; = diff -r 89e12551753e -r 7695ab54cee1 magick/delegate.c --- a/magick/delegate.c Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/delegate.c Sat Jul 13 18:15:14 2024 -0500 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003 - 2022 GraphicsMagick Group +% Copyright (C) 2003 - 2024 GraphicsMagick Group % Copyright (C) 2002 ImageMagick Studio % % This program is covered by multiple licenses, which are described in @@ -1216,8 +1216,11 @@ = /* Format output so that command spans multiple lines if necessary */ - if (getenv("COLUMNS")) - screen_width=3DMagickAtoI(getenv("COLUMNS"))-1; + { + const char * const columns_env =3D getenv("COLUMNS"); + if (columns_env) + screen_width=3DMagickAtoI(columns_env)-1; + } command_length=3Dstrlen(commands[0]); command_start_column=3Dfprintf(file,"%8s%c=3D%c%s ",p->decode ? p->= decode : "", p->mode <=3D 0 ? '<' : ' ',p->mode >=3D 0 ? '>' : ' ',delegate); diff -r 89e12551753e -r 7695ab54cee1 magick/display.c --- a/magick/display.c Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/display.c Sat Jul 13 18:15:14 2024 -0500 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003 - 2022 GraphicsMagick Group +% Copyright (C) 2003 - 2024 GraphicsMagick Group % Copyright (C) 2002 ImageMagick Studio % Copyright 1991-1999 E. I. du Pont de Nemours and Company % @@ -10682,9 +10682,9 @@ handler; = RectangleInfo - crop_info, - highlight_info, - roi_info; + crop_info =3D { 0, 0, 0, 0}, + highlight_info =3D { 0, 0, 0, 0}, + roi_info =3D { 0, 0, 0, 0}; = unsigned int height, diff -r 89e12551753e -r 7695ab54cee1 magick/draw.c --- a/magick/draw.c Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/draw.c Sat Jul 13 18:15:14 2024 -0500 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003-2018 GraphicsMagick Group +% Copyright (C) 2003-2024 GraphicsMagick Group % Copyright (C) 2002 ImageMagick Studio % Copyright 1991-1999 E. I. du Pont de Nemours and Company % @@ -4785,11 +4785,11 @@ % % o context: drawing context % -% o num_elems: address to place number of elements in dash array +% o number_elements: address to place number of elements in dash array % % */ MagickExport double *DrawGetStrokeDashArray(DrawContext context, - unsigned long *num_elems) + unsigned long *number_elements) { register const double *p; @@ -4798,37 +4798,36 @@ *q; = double - *dasharray; - - unsigned int + *dash_array; + + unsigned long i, n =3D 0; = assert(context !=3D (DrawContext)NULL); assert(context->signature =3D=3D MagickSignature); - assert(num_elems !=3D (unsigned long *)NULL); + assert(number_elements !=3D (unsigned long *)NULL); = p =3D CurrentContext->dash_pattern; - if( p !=3D (const double *) NULL ) - while( *p++ !=3D 0.0) + if ( p !=3D (const double *) NULL ) + while (*p++ !=3D 0.0) n++; = - *num_elems =3D n; - dasharray =3D (double *)NULL; + *number_elements =3D n; + dash_array =3D (double *) NULL; if (n !=3D 0) { - dasharray =3D MagickAllocateArray(double *, (size_t) n+1, sizeof(dou= ble)); - if (dasharray !=3D (double*)NULL) + dash_array =3D MagickAllocateArray(double *, (size_t) n+1, sizeof(do= uble)); + if (dash_array !=3D (double*) NULL) { p =3D CurrentContext->dash_pattern; - q =3D dasharray; - i =3D n; - while( i-- ) + q =3D dash_array; + for (i=3D0; i < n; i++) *q++ =3D *p++; *q=3D0.0; } } - return dasharray; + return dash_array; } =0C /* diff -r 89e12551753e -r 7695ab54cee1 magick/image.c --- a/magick/image.c Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/image.c Sat Jul 13 18:15:14 2024 -0500 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003-2022 GraphicsMagick Group +% Copyright (C) 2003-2024 GraphicsMagick Group % Copyright (C) 2003 ImageMagick Studio % Copyright 1991-1999 E. I. du Pont de Nemours and Company % @@ -2876,7 +2876,8 @@ } if (*q =3D=3D '\0') { - subrange -=3D subimage-1; + if (subimage > 0) + subrange -=3D subimage-1; *subimage_ptr=3Dsubimage; *subrange_ptr=3Dsubrange; status=3DMagickPass; diff -r 89e12551753e -r 7695ab54cee1 magick/version.h --- a/magick/version.h Sun Jul 07 17:54:29 2024 -0500 +++ b/magick/version.h Sat Jul 13 18:15:14 2024 -0500 @@ -38,8 +38,8 @@ #define MagickLibVersion 0x282500 #define MagickLibVersionText "1.4" #define MagickLibVersionNumber 28,25,0 -#define MagickChangeDate "20240707" -#define MagickReleaseDate "snapshot-20240707" +#define MagickChangeDate "20240713" +#define MagickReleaseDate "snapshot-20240713" = /* The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines diff -r 89e12551753e -r 7695ab54cee1 wand/drawing_wand.c --- a/wand/drawing_wand.c Sun Jul 07 17:54:29 2024 -0500 +++ b/wand/drawing_wand.c Sat Jul 13 18:15:14 2024 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2015 GraphicsMagick Group */ +/* Copyright (C) 2003-2024 GraphicsMagick Group */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%= %%%%% % = % @@ -4480,28 +4480,32 @@ double *dash_array; = - unsigned int + unsigned long i, - n=3D0; + n =3D 0; = assert(drawing_wand !=3D (const DrawingWand *) NULL); assert(drawing_wand->signature =3D=3D MagickSignature); assert(number_elements !=3D (unsigned long *)NULL); - p=3DCurrentContext->dash_pattern; + + p =3D CurrentContext->dash_pattern; if ( p !=3D (const double *) NULL ) while (*p++ !=3D 0.0) n++; - *number_elements=3Dn; - dash_array=3D(double *)NULL; + + *number_elements =3D n; + dash_array =3D (double *) NULL; if (n !=3D 0) { - dash_array=3DMagickAllocateArray(double *, (size_t) n+1, sizeof(doub= le)); - p=3DCurrentContext->dash_pattern; - q=3Ddash_array; - i=3Dn; - while (i--) - *q++=3D(*p++); - *q=3D0.0; + dash_array =3D MagickAllocateArray(double *, (size_t) n+1, sizeof(do= uble)); + if (dash_array !=3D (double *) NULL) + { + p =3D CurrentContext->dash_pattern; + q =3D dash_array; + for (i=3D0; i < n; i++) + *q++ =3D (*p++); + *q=3D0.0; + } } return(dash_array); } diff -r 89e12551753e -r 7695ab54cee1 www/ChangeLog.html --- a/www/ChangeLog.html Sun Jul 07 17:54:29 2024 -0500 +++ b/www/ChangeLog.html Sat Jul 13 18:15:14 2024 -0500 @@ -38,15 +38,45 @@ = <main id=3D"graphicsmagick-changelog"> <h1 class=3D"title">GraphicsMagick ChangeLog</h1> +<p>2024-07-13 Bob Friesenhahn <<a class=3D"reference external" href= =3D"mailto:bfriesen%40simple.dallas.tx.us">bfriesen= <span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>&= #46;</span>us</a>></p> +<blockquote> +<ul class=3D"simple"> +<li><p>magick/display.c (MagickXROIImage): Fix clang-analyzer issue.</p></= li> +<li><p>magick/delegate.c (ListDelegateInfo): Fix clang-analyzer issue.</p>= </li> +<li><p>magick/command.c (TimeImageCommand): Fix clang-analyzer issue.</p><= /li> +</ul> +</blockquote> +<p>2024-07-09 Bob Friesenhahn <<a class=3D"reference external" href= =3D"mailto:bfriesen%40simple.dallas.tx.us">bfriesen= <span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>&= #46;</span>us</a>></p> +<blockquote> +<ul class=3D"simple"> +<li><p>magick/image.c (MagickParseSubImageSpecification): Quiet +Coverity 427451 "Overflowed constant".</p></li> +<li><p>magick/analyze.c (MinimumDepthForValue): Fix loop bounds and +avoid overflow of the return value. Addresses Coverity 427448 +"Overflowed constant".</p></li> +</ul> +</blockquote> +<p>2024-07-08 Bob Friesenhahn <<a class=3D"reference external" href= =3D"mailto:bfriesen%40simple.dallas.tx.us">bfriesen= <span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>&= #46;</span>us</a>></p> +<blockquote> +<ul class=3D"simple"> +<li><p>wand/drawing_wand.c (DrawGetStrokeDashArray): Avoid integer +underflow in loop. Addresses Coverity 427450 "Overflowed +constant."</p></li> +<li><p>magick/draw.c (DrawGetStrokeDashArray): Avoid integer underflow +in loop. Addresses Coverity 427460 "Overflowed constant".</p></l= i> +</ul> +</blockquote> <p>2024-07-07 Bob Friesenhahn <<a class=3D"reference external" href= =3D"mailto:bfriesen%40simple.dallas.tx.us">bfriesen= <span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>&= #46;</span>us</a>></p> <blockquote> <ul class=3D"simple"> +<li><p>coders/tiff.c (InitializeImageColormap): Verify that +TIFFTAG_BITSPERSAMPLE is within a rational range.</p></li> <li><p>coders/gif.c (ReadGIFImage): Don't evaluate background color if image->colors =3D=3D 0. Coverity did not detect that previous error handling would already have caught this issue.</p></li> <li><p>coders/pnm.c (PNMInteger): Code simplification, and convince -Convince Coverity that value returned by ReadBlobByte() is -positive if it is not EOF.</p></li> +Coverity that value returned by ReadBlobByte() is positive if it +is not EOF.</p></li> <li><p>coders/txt.c (ReadInt): Convince Coverity that value returned by ReadBlobByte() is positive if it is not EOF.</p></li> <li><p>coders/sct.c (ReadSCTImage): Convince Coverity that value diff -r 89e12551753e -r 7695ab54cee1 www/api/display.html --- a/www/api/display.html Sun Jul 07 17:54:29 2024 -0500 +++ b/www/api/display.html Sat Jul 13 18:15:14 2024 -0500 @@ -36,7 +36,7 @@ </ul> </div> = -<div class=3D"document" id=3D"display"> +<main id=3D"display"> <h1 class=3D"title">display</h1> <p class=3D"subtitle" id=3D"interactively-display-and-edit-an-image">Inter= actively display and edit an image</p> <div class=3D"contents topic" id=3D"contents"> @@ -46,15 +46,15 @@ <li><p><a class=3D"reference internal" href=3D"#magickxdisplayimage" id=3D= "id4">MagickXDisplayImage</a></p></li> </ul> </div> -<div class=3D"section" id=3D"magickxdisplaybackgroundimage"> +<section id=3D"magickxdisplaybackgroundimage"> <h1><a class=3D"toc-backref" href=3D"#id3">MagickXDisplayBackgroundImage</= a></h1> -<div class=3D"section" id=3D"synopsis"> +<section id=3D"synopsis"> <h2>Synopsis</h2> <pre class=3D"literal-block">unsigned int MagickXDisplayBackgroundImage( D= isplay *display, <a class=3D"reference external= " href=3D"../api/types.html#magickxresourceinfo">MagickXResourceInfo</a> *r= esource_info, <a class=3D"reference external= " href=3D"../api/types.html#image">Image</a> *image );</pre> -</div> -<div class=3D"section" id=3D"description"> +</section> +<section id=3D"description"> <h2>Description</h2> <p>MagickXDisplayBackgroundImage() displays an image in the background of = a window.</p> <p>The format of the MagickXDisplayBackgroundImage method is:</p> @@ -74,17 +74,17 @@ ReadImage.</p> </dd> </dl> -</div> -</div> -<div class=3D"section" id=3D"magickxdisplayimage"> +</section> +</section> +<section id=3D"magickxdisplayimage"> <h1><a class=3D"toc-backref" href=3D"#id4">MagickXDisplayImage</a></h1> -<div class=3D"section" id=3D"id1"> +<section id=3D"id1"> <h2>Synopsis</h2> <pre class=3D"literal-block"><a class=3D"reference external" href=3D"../ap= i/types.html#image">Image</a> *MagickXDisplayImage( Display *display, <a cl= ass=3D"reference external" href=3D"../api/types.html#magickxresourceinfo">M= agickXResourceInfo</a> *resource_info, char ** argv, int argc, <a class=3D"reference = external" href=3D"../api/types.html#image">Image</a> ** image, unsigned long *state );</pre> -</div> -<div class=3D"section" id=3D"id2"> +</section> +<section id=3D"id2"> <h2>Description</h2> <p>MagickXDisplayImage() displays an image via X11. A new image is create= d and returned if the user interactively transforms the displayed image.</p> @@ -116,9 +116,9 @@ returned from ReadImage.</p> </dd> </dl> -</div> -</div> -</div> +</section> +</section> +</main> = = <hr class=3D"docutils"> @@ -126,6 +126,6 @@ <p><a href=3D"../Copyright.html">Copyright</a> =A9 GraphicsMagick Grou= p 2002 - 2024<!--SPONSOR_LOGO--></p> </div> = -</div> +</main> </body> </html> diff -r 89e12551753e -r 7695ab54cee1 www/api/draw.html --- a/www/api/draw.html Sun Jul 07 17:54:29 2024 -0500 +++ b/www/api/draw.html Sat Jul 13 18:15:14 2024 -0500 @@ -36,7 +36,7 @@ </ul> </div> = -<div class=3D"document" id=3D"draw"> +<main id=3D"draw"> <h1 class=3D"title">draw</h1> <p class=3D"subtitle" id=3D"user-friendly-methods-to-draw-on-an-image">Use= r-friendly methods to draw on an image</p> <div class=3D"contents topic" id=3D"contents"> @@ -157,14 +157,14 @@ <li><p><a class=3D"reference internal" href=3D"#drawsetviewbox" id=3D"id33= 7">DrawSetViewbox</a></p></li> </ul> </div> -<div class=3D"section" id=3D"drawannotation"> +<section id=3D"drawannotation"> <h1><a class=3D"toc-backref" href=3D"#id225">DrawAnnotation</a></h1> -<div class=3D"section" id=3D"synopsis"> +<section id=3D"synopsis"> <h2>Synopsis</h2> <pre class=3D"literal-block">void DrawAnnotation( <a class=3D"reference ex= ternal" href=3D"../api/types.html#drawcontext">DrawContext</a> context, con= st double x, const double y, const unsigned char *text );</pre> -</div> -<div class=3D"section" id=3D"description"> +</section> +<section id=3D"description"> <h2>Description</h2> <p>DrawAnnotation() draws text on the image.</p> <p>The format of the DrawAnnotation method is:</p> @@ -184,15 +184,15 @@ <dd><p>text to draw</p> </dd> </dl> -</div> -</div> -<div class=3D"section" id=3D"drawaffine">