Package: graphicsmagick
Version: 1.4+really1.3.36+hg16481-1
Severity: normal
Tags: patch upstream

Dear Maintainer,

If the -label option is given when writing a PDF, the following
assertion failure occurs:

    $ gm convert -label MyLabel xc:#ffffff labeled.pdf
    gm: magick/memory.c:678: _MagickReallocateResourceLimitedMemory: Assertion 
`memory_resource.signature == MagickSignature' failed.
    gm convert: abort due to signal 6 (SIGABRT) "Abort"...

I reported the issue upstream in [#646] and it was fixed in
[22aaff86b4aa].  I'm reporting it here, as suggested by upstream, so
that you are aware, and in case you'd like to carry the patch
(attached) until a new upstream version is released.

Thanks,
Kevin

[#646]: https://sourceforge.net/p/graphicsmagick/bugs/646/
[22aaff86b4aa]: 
https://sourceforge.net/p/graphicsmagick/code/ci/22aaff86b4aa34c10b3fbfb104adaaeef8653a36/


-- System Information:
Debian Release: 11.0
  APT prefers testing-debug
  APT policy: (990, 'testing-debug'), (990, 'testing'), (500, 
'unstable-debug'), (500, 'testing-security'), (500, 'stable-debug'), (500, 
'unstable'), (500, 'oldstable'), (101, 'experimental'), (1, 
'experimental-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.14.0-rc2 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages graphicsmagick depends on:
ii  libc6                    2.31-12
ii  libgraphicsmagick-q16-3  1.4+really1.3.36+hg16481-1

graphicsmagick recommends no packages.

Versions of packages graphicsmagick suggests:
pn  graphicsmagick-dbg  <none>

-- no debconf information
Subject: WritePDFImage(): Use appropriate memory deallocator for memory 
returned by StringToList().
Origin: 
https://sourceforge.net/p/graphicsmagick/code/ci/22aaff86b4aa34c10b3fbfb104adaaeef8653a36/
Bug: https://sourceforge.net/p/graphicsmagick/bugs/646/
From: Bob Friesenhahn <bfrie...@graphicsmagick.org>
Applied-Upstream: commit:22aaff86b4aa34c10b3fbfb104adaaeef8653a36

# HG changeset patch
# User Bob Friesenhahn <bfrie...@graphicsmagick.org>
# Date 1626915582 18000
#      Wed Jul 21 19:59:42 2021 -0500
# Node ID 22aaff86b4aa34c10b3fbfb104adaaeef8653a36
# Parent  acf305f9ef3e85e6273d62e72d81cce03440eb3d
WritePDFImage(): Use appropriate memory deallocator for memory returned by 
StringToList().

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,14 @@
 2021-07-21  Bob Friesenhahn  <bfrie...@simple.dallas.tx.us>
 
+        * coders/pdf.c (WritePDFImage): Use appropriate memory deallocator
+        for memory returned by StringToList().  Fixes SourceForge issue
+        646 "Assertion failed using -label with PDF".
+
         * coders/webp.c (ReadWEBPImage): Add full error checking when
         retrieving embedded profiles.
 
         * magick/profile.c (SetImageProfile): Do not try to store a
         zero-sized profile.
 
         * coders/webp.c (ReadWEBPImage): Enforce that embedded profiles
         provided by libWebP are not zero-sized. This problem was brought
diff --git a/coders/pdf.c b/coders/pdf.c
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -1041,19 +1041,19 @@ static unsigned int WritePDFImage(const 
                            image_info->pointsize);
               (void) WriteBlobString(image,buffer);
               FormatString(buffer,"%ld %g Td\n",geometry.x,(double) geometry.y+
                            (double) geometry.height+i*(double) 
image_info->pointsize+12);
               (void) WriteBlobString(image,buffer);
               FormatString(buffer,"(%.1024s) Tj\n",labels[i]);
               (void) WriteBlobString(image,buffer);
               (void) WriteBlobString(image,"ET\n");
-              MagickFreeResourceLimitedMemory(labels[i]);
+              MagickFreeMemory(labels[i]);
             }
-          MagickFreeResourceLimitedMemory(labels);
+          MagickFreeMemory(labels);
         }
       FormatString(buffer,"%g 0 0 %g %ld %ld cm\n",x_scale,y_scale,geometry.x,
                    geometry.y);
       (void) WriteBlobString(image,buffer);
       FormatString(buffer,"/Im%lu Do\n",image->scene);
       (void) WriteBlobString(image,buffer);
       (void) WriteBlobString(image,"Q\n");
       offset=TellBlob(image)-offset;
diff --git a/www/Changelog.html b/www/Changelog.html
--- a/www/Changelog.html
+++ b/www/Changelog.html
@@ -32,16 +32,19 @@
   <li><a href="reference.html">Reference</a></li>
 </ul>
 </div>
 <div class="document">
 
 
 <p>2021-07-21  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>
+<p>* coders/pdf.c (WritePDFImage): Use appropriate memory deallocator
+for memory returned by StringToList().  Fixes SourceForge issue
+646 &quot;Assertion failed using -label with PDF&quot;.</p>
 <p>* coders/webp.c (ReadWEBPImage): Add full error checking when
 retrieving embedded profiles.</p>
 <p>* magick/profile.c (SetImageProfile): Do not try to store a
 zero-sized profile.</p>
 <p>* coders/webp.c (ReadWEBPImage): Enforce that embedded profiles
 provided by libWebP are not zero-sized. This problem was brought
 to our attention by Shane Bishop on the graphicsmagick-help
 mailing list.</p>

Reply via email to