GraphicsMagick: JP2: JasPer wants its custom memory allocators t...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.42446.1640197851.2008.graphicsmagick-commit@lists.sourceforge.net>
changeset dd0b1269c3c8 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=dd0b1269c3c8
summary: JP2: JasPer wants its custom memory allocators to return non-null for a zero-sized request.  Make it so for the 'realloc' case as well.

diffstat:

 ChangeLog       |  4 ++++
 coders/jp2.c    |  4 +++-
 magick/memory.c |  2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r d6040593dde5 -r dd0b1269c3c8 ChangeLog
--- a/ChangeLog	Wed Dec 22 10:16:43 2021 -0600
+++ b/ChangeLog	Wed Dec 22 12:30:36 2021 -0600
@@ -1,5 +1,9 @@
 2021-12-22  Bob Friesenhahn  <[email protected]>
 
+        * coders/jp2.c (realloc_rlm): JasPer wants its custom memory
+        allocators to return non-null for a zero-sized request.  Make it
+        so for the 'realloc' case as well.
+
         * coders/mat.c (ReadMATImageV4): Change 'ldblk' to size_t and
         check related calculations for overflow and to avoid possible
         negative seek offsets.
diff -r d6040593dde5 -r dd0b1269c3c8 coders/jp2.c
--- a/coders/jp2.c	Wed Dec 22 10:16:43 2021 -0600
+++ b/coders/jp2.c	Wed Dec 22 12:30:36 2021 -0600
@@ -424,7 +424,7 @@
                          size_t new_size)
 {
   (void) allocator;
-  return _MagickReallocateResourceLimitedMemory(pointer,1,new_size,0);
+  return _MagickReallocateResourceLimitedMemory(pointer,1,new_size == 0 ? 1 : new_size,0);
 }
 #endif /* if HAVE_JAS_INITIALIZE */
 static void initialize_jasper(void)
@@ -460,6 +460,8 @@
         if (jas_init() == 0)
           {
             jasper_initialized=MagickTrue;
+            (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                                "Initialized JasPer");
           }
       }
 #endif  /* HAVE_JAS_INITIALIZE */
diff -r d6040593dde5 -r dd0b1269c3c8 magick/memory.c
--- a/magick/memory.c	Wed Dec 22 10:16:43 2021 -0600
+++ b/magick/memory.c	Wed Dec 22 12:30:36 2021 -0600
@@ -695,7 +695,7 @@
     status = MagickPass;
 
 #if defined(MAGICK_DEBUG_RL_MEMORY) && MAGICK_DEBUG_RL_MEMORY
-  fprintf(stderr,"%d: p = %p, count = %zu, size =%zu\n", __LINE__, p, count, size);
+  fprintf(stderr,"%d: p = %p, count = %zu, size = %zu\n", __LINE__, p, count, size);
 #endif
 
   /* Copy (or init) 'memory_resource' based on provided user-land pointer */
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.