[gdk-pixbuf] gif: Escape GIF version in error message



commit f58d6cce2a04afaf1c62808a1f75d73e434c3706
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Jul 26 11:18:58 2019 +1200

    gif: Escape GIF version in error message
    
    A corrupt file might have non valid UTF-8 data in the version, so we need to
    escape it.

 gdk-pixbuf/io-gif.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index be5bfc235..45cabacba 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -1167,12 +1167,16 @@ gif_init (GifContext *context)
        version[3] = '\0';
 
        if ((strcmp (version, "87a") != 0) && (strcmp (version, "89a") != 0)) {
+               gchar *escaped_version;
+
                /* bad version number, not '87a' or '89a' */
+               escaped_version = g_strescape (version, NULL);
                 g_set_error (context->error,
                              GDK_PIXBUF_ERROR,
                              GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                              _("Version %s of the GIF file format is not supported"),
-                             version);
+                             escaped_version);
+               g_free (escaped_version);
                return -2;
        }
 


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