GraphicsMagick: MogrifyImage(): Improve ordered-dither parameter...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.2108.1678664301.1748.graphicsmagick-commit@lists.sourceforge.net>
changeset 0d3ace2bc272 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=0d3ace2bc272
summary: MogrifyImage(): Improve ordered-dither parameter validation

diffstat:

 ChangeLog          |  3 +++
 magick/command.c   |  5 +++++
 magick/utility.c   |  2 +-
 www/Changelog.html |  5 ++++-
 4 files changed, 13 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r aa44650e43ff -r 0d3ace2bc272 ChangeLog
--- a/ChangeLog	Sun Mar 12 14:46:21 2023 -0500
+++ b/ChangeLog	Sun Mar 12 18:38:07 2023 -0500
@@ -6,6 +6,9 @@
 	(MogrifyImage): Improve operator parameter validation.  Addresses
 	SourceForge issue #694 "Segmentation Violation in gm (MagickStrToD
 	function)".
+	(MogrifyImage): Improve ordered-dither parameter
+	validation. Addresses SourceForge issue #695 "Segmentation
+	Violation in gm (LocaleCompare).
 
 	* magick/error.c (DefaultFatalErrorHandler): Perform printf
 	substitutions similar to DefaultErrorHandler.
diff -r aa44650e43ff -r 0d3ace2bc272 magick/command.c
--- a/magick/command.c	Sun Mar 12 14:46:21 2023 -0500
+++ b/magick/command.c	Sun Mar 12 18:38:07 2023 -0500
@@ -10439,6 +10439,11 @@
             /*
               Ordered-dither image.
             */
+            if (i+2 > argc)
+              {
+                ThrowException(&(*image)->exception,OptionError,MissingArgument,option+1);
+                break;
+              }
             (void) RandomChannelThresholdImage(*image,argv[i+1],argv[i+2],
                 &(*image)->exception);
             i+=2;
diff -r aa44650e43ff -r 0d3ace2bc272 magick/utility.c
--- a/magick/utility.c	Sun Mar 12 14:46:21 2023 -0500
+++ b/magick/utility.c	Sun Mar 12 18:38:07 2023 -0500
@@ -930,7 +930,7 @@
   */
   assert(argc != (int *) NULL);
   assert(argv != (char ***) NULL);
-  vector=MagickAllocateClearedMemory(char **,(*argc+prealloc_entries)*sizeof(char *));
+  vector=MagickAllocateMemory(char **,(*argc+prealloc_entries)*sizeof(char *));
   if (vector == (char **) NULL)
     return(MagickFail);
   /*
diff -r aa44650e43ff -r 0d3ace2bc272 www/Changelog.html
--- a/www/Changelog.html	Sun Mar 12 14:46:21 2023 -0500
+++ b/www/Changelog.html	Sun Mar 12 18:38:07 2023 -0500
@@ -45,7 +45,10 @@
 &quot;Segmentation Violation in gm - SetImageAttribute function&quot;.
 (MogrifyImage): Improve operator parameter validation.  Addresses
 SourceForge issue #694 &quot;Segmentation Violation in gm (MagickStrToD
-function)&quot;.</p></li>
+function)&quot;.
+(MogrifyImage): Improve ordered-dither parameter
+validation. Addresses SourceForge issue #695 &quot;Segmentation
+Violation in gm (LocaleCompare).</p></li>
 <li><p>magick/error.c (DefaultFatalErrorHandler): Perform printf
 substitutions similar to DefaultErrorHandler.</p></li>
 <li><p>magick/error.h: Add parameter names to prototypes.</p></li>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.