[gimp] Bug 766824 - Invalid comment string causes export crash



commit cf3b6903c012c74b787de6eeaa1670adb63ecba2
Author: Michael Natterer <mitch gimp org>
Date:   Mon May 30 18:56:29 2016 +0200

    Bug 766824 - Invalid comment string causes export crash
    
    UTF-8 validate the "gimp-comment" parasite and reject it on failure.

 app/core/gimpimage.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 502dc67..40bfe9b 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3408,6 +3408,18 @@ gimp_image_parasite_validate (GimpImage           *image,
     {
       return gimp_image_validate_icc_parasite (image, parasite, NULL, error);
     }
+  else if (strcmp (name, "gimp-comment") == 0)
+    {
+      if (! g_utf8_validate (gimp_parasite_data (parasite),
+                             gimp_parasite_data_size (parasite),
+                             NULL))
+        {
+          g_set_error (error, GIMP_ERROR, GIMP_FAILED,
+                       _("'gimp-comment' parasite validation failed: "
+                         "comment contains invalid UTF-8"));
+          return FALSE;
+        }
+    }
 
   return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]