GraphicsMagick: WebP: Add full error checking when retrieving em...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.79175.1626914875.1503.graphicsmagick-commit@lists.sourceforge.net>
changeset acf305f9ef3e in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=acf305f9ef3e
summary: WebP: Add full error checking when retrieving embedded profiles.

diffstat:

 ChangeLog          |   3 +++
 coders/webp.c      |  19 +++++++++++++------
 www/Changelog.html |   2 ++
 3 files changed, 18 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r 7fd8cd0b7b07 -r acf305f9ef3e ChangeLog
--- a/ChangeLog	Wed Jul 21 17:45:58 2021 -0500
+++ b/ChangeLog	Wed Jul 21 19:47:33 2021 -0500
@@ -1,5 +1,8 @@
 2021-07-21  Bob Friesenhahn  <[email protected]>
 
+        * 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.
 
diff -r 7fd8cd0b7b07 -r acf305f9ef3e coders/webp.c
--- a/coders/webp.c	Wed Jul 21 17:45:58 2021 -0500
+++ b/coders/webp.c	Wed Jul 21 19:47:33 2021 -0500
@@ -307,28 +307,35 @@
     uint32_t webp_flags=0;
     WebPData flag_data;
     WebPData content={stream,length};
+    WebPMuxError mux_error;
 
     WebPMux *mux=WebPMuxCreate(&content,0);
     (void) memset(&flag_data,0,sizeof(flag_data));
     WebPMuxGetFeatures(mux,&webp_flags);
 
-    if (webp_flags & ICCP_FLAG)
+    if ((webp_flags & ICCP_FLAG) &&
+        ((mux_error=WebPMuxGetChunk(mux,"ICCP",&flag_data)) == WEBP_MUX_OK))
       {
-        WebPMuxGetChunk(mux,"ICCP",&flag_data);
+        (void) LogMagickEvent(CoderEvent,GetMagickModule(),"ICCP Profile: %lu bytes",
+                              (unsigned long) flag_data.size);
         if ((flag_data.bytes != NULL) && (flag_data.size > 0))
           SetImageProfile(image,"ICC",flag_data.bytes,flag_data.size);
       }
 
-    if (webp_flags & EXIF_FLAG)
+    if ((webp_flags & EXIF_FLAG) &&
+        ((mux_error=WebPMuxGetChunk(mux,"EXIF",&flag_data)) == WEBP_MUX_OK))
       {
-        WebPMuxGetChunk(mux,"EXIF",&flag_data);
+        (void) LogMagickEvent(CoderEvent,GetMagickModule(),"EXIF Profile: %lu bytes",
+                              (unsigned long) flag_data.size);
         if ((flag_data.bytes != NULL) && (flag_data.size > 0))
           SetImageProfile(image,"EXIF",flag_data.bytes,flag_data.size);
       }
 
-    if (webp_flags & XMP_FLAG)
+    if ((webp_flags & XMP_FLAG) &&
+        ((mux_error=WebPMuxGetChunk(mux,"XMP",&flag_data)) == WEBP_MUX_OK))
       {
-        WebPMuxGetChunk(mux,"XMP",&flag_data);
+        (void) LogMagickEvent(CoderEvent,GetMagickModule(),"XMP Profile: %lu bytes",
+                              (unsigned long) flag_data.size);
         if ((flag_data.bytes != NULL) && (flag_data.size > 0))
           SetImageProfile(image,"XMP",flag_data.bytes,flag_data.size);
       }
diff -r 7fd8cd0b7b07 -r acf305f9ef3e www/Changelog.html
--- a/www/Changelog.html	Wed Jul 21 17:45:58 2021 -0500
+++ b/www/Changelog.html	Wed Jul 21 19:47:33 2021 -0500
@@ -37,6 +37,8 @@
 
 <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/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
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.