GraphicsMagick: AllocateDepthMap(): Use resource-limited memory ...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.2553.1685819109.17685.graphicsmagick-commit@lists.sourceforge.net>
changeset bb068ff50d5c in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=bb068ff50d5c
summary: AllocateDepthMap(): Use resource-limited memory allocator.

diffstat:

 ChangeLog                              |  13 ++++++++++---
 VisualMagick/installer/inc/version.isx |   4 ++--
 magick/analyze.c                       |   4 ++--
 magick/operator.c                      |  18 +++++++++++-------
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |  29 ++++++++++++++++-------------
 6 files changed, 43 insertions(+), 29 deletions(-)

diffs (187 lines):

diff -r 91f43cb66057 -r bb068ff50d5c ChangeLog
--- a/ChangeLog	Fri Jun 02 20:10:13 2023 -0500
+++ b/ChangeLog	Sat Jun 03 14:04:58 2023 -0500
@@ -1,7 +1,14 @@
+2023-06-03  Bob Friesenhahn  <[email protected]>
+
+	* magick/analyze.c (AllocateDepthMap): Use resource-limited memory
+	allocator.
+
+	* magick/operator.c (QuantumDepthCB): Janitorial cleanups.
+
 2023-06-02  Bob Friesenhahn  <[email protected]>
 
 	* magick/command.c (MogrifyImage): Validate the number of
-	-random-threshold arguments.  Addresses SourceForge issue #700
+	'-random-threshold' arguments.  Addresses SourceForge issue #700
 	Segmentation Violation in gm (magick/utility.c:3399 in
 	LocaleCompare)".
 
@@ -14,8 +21,8 @@
 
 	* magick/transform.c (ChopImage): Assure that chop image has valid
 	dimensions.  Addresses SourceForge issue #697 "Assertion
-	`image->columns != 0' failed in gm (RollImage at
-	magick/transform.c:1532)" and issue #698 "Assertion `image->rows
+	'image->columns != 0' failed in gm (RollImage at
+	magick/transform.c:1532)" and issue #698 "Assertion 'image->rows
 	!= 0' failed (magick/transform.c:1533 at RollImage)".
 
 2023-05-27  Bob Friesenhahn  <[email protected]>
diff -r 91f43cb66057 -r bb068ff50d5c VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Fri Jun 02 20:10:13 2023 -0500
+++ b/VisualMagick/installer/inc/version.isx	Sat Jun 03 14:04:58 2023 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020230602"
-#define public MagickPackageReleaseDate "snapshot-20230602"
+#define public MagickPackageVersionAddendum ".020230603"
+#define public MagickPackageReleaseDate "snapshot-20230603"
diff -r 91f43cb66057 -r bb068ff50d5c magick/analyze.c
--- a/magick/analyze.c	Fri Jun 02 20:10:13 2023 -0500
+++ b/magick/analyze.c	Sat Jun 03 14:04:58 2023 -0500
@@ -315,7 +315,7 @@
   magick_uint8_t
     *map;
 
-  map = MagickAllocateArray(unsigned char *, MaxMap+1, sizeof(magick_uint8_t));
+  map = MagickAllocateResourceLimitedArray(unsigned char *, MaxMap+1, sizeof(magick_uint8_t));
   if (map != (unsigned char *) NULL)
     {
       unsigned int
@@ -467,7 +467,7 @@
                                   image->rows,image,exception);
     }
 
-  MagickFreeMemory(map);
+  MagickFreeResourceLimitedMemory(map);
 
   return depth;
 }
diff -r 91f43cb66057 -r bb068ff50d5c magick/operator.c
--- a/magick/operator.c	Fri Jun 02 20:10:13 2023 -0500
+++ b/magick/operator.c	Sat Jun 03 14:04:58 2023 -0500
@@ -520,11 +520,13 @@
 
   return (MagickPass);
 }
+#if 0
 #define ApplyChannelDepth(parameter)                                    \
   {                                                                     \
     for (i=0; i < npixels; i++)                                         \
       parameter=scale*((parameter)/scale);                              \
   }
+#endif
 #if MaxRGB > MaxMap
 #  define CrushChannelDepth(parameter) (scale*((parameter)/scale))
 #else
@@ -548,9 +550,6 @@
   unsigned int
     depth;
 
-  register unsigned int
-    scale;
-
   register long
     i;
 
@@ -568,8 +567,6 @@
 
   if (depth < QuantumDepth)
     {
-      scale=MaxRGB / (MaxRGB >> (QuantumDepth-depth));
-
       /*
         Build LUT for Q8 and Q16 builds
       */
@@ -579,14 +576,21 @@
 #  endif
       if (mutable_context->channel_lut == (Quantum *) NULL)
         {
+          unsigned int
+            scale;
+
+          scale=MaxRGB / (MaxRGB >> (QuantumDepth-depth));
           mutable_context->channel_lut=MagickAllocateArray(Quantum *, MaxMap+1,sizeof(Quantum));
           if (mutable_context->channel_lut == (Quantum *) NULL)
             status=MagickFail;
 
           if (mutable_context->channel_lut != (Quantum *) NULL)
             {
-              for (i=0; i <= (long) MaxMap; i++)
-                mutable_context->channel_lut[i] = scale*(i/scale);
+              unsigned int
+                li;
+
+              for (li=0; li <= MaxMap; li++)
+                mutable_context->channel_lut[li] = scale*(li/scale);
             }
         }
 
diff -r 91f43cb66057 -r bb068ff50d5c magick/version.h
--- a/magick/version.h	Fri Jun 02 20:10:13 2023 -0500
+++ b/magick/version.h	Sat Jun 03 14:04:58 2023 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x272402
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 27,24,2
-#define MagickChangeDate   "20230602"
-#define MagickReleaseDate  "snapshot-20230602"
+#define MagickChangeDate   "20230603"
+#define MagickReleaseDate  "snapshot-20230603"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r 91f43cb66057 -r bb068ff50d5c www/Changelog.html
--- a/www/Changelog.html	Fri Jun 02 20:10:13 2023 -0500
+++ b/www/Changelog.html	Sat Jun 03 14:04:58 2023 -0500
@@ -37,9 +37,21 @@
 </div>
 
 <div class="document">
+<p>2023-06-03  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
+<blockquote>
+<ul class="simple">
+<li><p>magick/analyze.c (AllocateDepthMap): Use resource-limited memory
+allocator.</p></li>
+<li><p>magick/operator.c (QuantumDepthCB): Janitorial cleanups.</p></li>
+</ul>
+</blockquote>
 <p>2023-06-02  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li><p>magick/command.c (MogrifyImage): Validate the number of
+'-random-threshold' arguments.  Addresses SourceForge issue #700
+Segmentation Violation in gm (magick/utility.c:3399 in
+LocaleCompare)&quot;.</p></li>
 <li><p>magick/montage.c (MontageImages): Report exception if tile
 geometry component is zero. Addresses SourceForge issue #699
 &quot;Floating Point Exception in gm (magick/montage.c:514 in
@@ -48,21 +60,12 @@
 </blockquote>
 <p>2023-05-31  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
-<ul>
+<ul class="simple">
 <li><p>magick/transform.c (ChopImage): Assure that chop image has valid
 dimensions.  Addresses SourceForge issue #697 &quot;Assertion
-<a href="#id1"><span class="problematic" id="id2">`</span></a>image-&gt;columns != 0' failed in gm (RollImage at
-magick/transform.c:1532)&quot; and issue #698 &quot;Assertion <a href="#id3"><span class="problematic" id="id4">`</span></a>image-&gt;rows
-!= 0' failed (magick/transform.c:1533 at RollImage)&quot;.</p>
-<div class="system-message" id="id1">
-<p class="system-message-title">System Message: WARNING/2 (<span class="docutils literal">&lt;string&gt;</span>, line 10); <em><a href="#id2">backlink</a></em></p>
-<p>Inline interpreted text or phrase reference start-string without end-string.</p>
-</div>
-<div class="system-message" id="id3">
-<p class="system-message-title">System Message: WARNING/2 (<span class="docutils literal">&lt;string&gt;</span>, line 10); <em><a href="#id4">backlink</a></em></p>
-<p>Inline interpreted text or phrase reference start-string without end-string.</p>
-</div>
-</li>
+'image-&gt;columns != 0' failed in gm (RollImage at
+magick/transform.c:1532)&quot; and issue #698 &quot;Assertion 'image-&gt;rows
+!= 0' failed (magick/transform.c:1533 at RollImage)&quot;.</p></li>
 </ul>
 </blockquote>
 <p>2023-05-27  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
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.