GraphicsMagick: MogrifyImage(): Validate colorspace argument.

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.1772.1678551099.1748.graphicsmagick-commit@lists.sourceforge.net>
changeset 3b80ce60d73c in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=3b80ce60d73c
summary: MogrifyImage(): Validate colorspace argument.

diffstat:

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

diffs (59 lines):

diff -r 6d44f7379961 -r 3b80ce60d73c ChangeLog
--- a/ChangeLog	Sat Mar 11 09:44:21 2023 -0600
+++ b/ChangeLog	Sat Mar 11 10:11:26 2023 -0600
@@ -3,6 +3,9 @@
 	* magick/command.c (MogrifyImage): Report a draw argument error if
 	drawing primitive is NULL.  Addresses SourceForge issue #684
 	"Assertion bug in gm (magick/render.c:2715)"
+	(MogrifyImage): Validate colorspace argument.  Addresses
+	SourceForge issue #685 Assertion bug in gm
+	(magick/colorspace.c:1045)".
 
 	* magick/utility.c (TranslateTextEx): An empty string argument
 	should return an empty string rather than a NULL string.
diff -r 6d44f7379961 -r 3b80ce60d73c magick/command.c
--- a/magick/command.c	Sat Mar 11 09:44:21 2023 -0600
+++ b/magick/command.c	Sat Mar 11 10:11:26 2023 -0600
@@ -9431,6 +9431,11 @@
             type=(*option);
             option=argv[++i];
             colorspace=StringToColorspaceType(option);
+            if (colorspace == UndefinedColorspace)
+              {
+                ThrowException(&(*image)->exception,OptionError,MissingArgument,"colorspace");
+                break;
+              }
             quantize_info.colorspace=colorspace;
             /* Never quantize in CMYK colorspace */
             if (IsCMYKColorspace(colorspace))
@@ -9691,10 +9696,12 @@
             */
             MagickFreeMemory(draw_info->primitive);
             draw_info->primitive=AmpersandTranslateText(clone_info,*image,argv[++i]);
-            if (draw_info->primitive != (char *) NULL)
+            if (draw_info->primitive == (char *) NULL)
+              {
+                ThrowException(&(*image)->exception,OptionError,MissingArgument,option);
+                break;
+              }
               (void) DrawImage(*image,draw_info);
-            else
-              ThrowException(&(*image)->exception,OptionError,MissingArgument,option);
             continue;
           }
         break;
diff -r 6d44f7379961 -r 3b80ce60d73c www/Changelog.html
--- a/www/Changelog.html	Sat Mar 11 09:44:21 2023 -0600
+++ b/www/Changelog.html	Sat Mar 11 10:11:26 2023 -0600
@@ -42,7 +42,10 @@
 <ul class="simple">
 <li><p>magick/command.c (MogrifyImage): Report a draw argument error if
 drawing primitive is NULL.  Addresses SourceForge issue #684
-&quot;Assertion bug in gm (magick/render.c:2715)&quot;</p></li>
+&quot;Assertion bug in gm (magick/render.c:2715)&quot;
+(MogrifyImage): Validate colorspace argument.  Addresses
+SourceForge issue #685 Assertion bug in gm
+(magick/colorspace.c:1045)&quot;.</p></li>
 <li><p>magick/utility.c (TranslateTextEx): An empty string argument
 should return an empty string rather than a NULL string.</p></li>
 </ul>
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.