[goffice] GOPixbuf: handle crazy rowstride.



commit ef572c72318d09f00a48724b894769918ff58bec
Author: Morten Welinder <terra gnome org>
Date:   Tue Nov 19 13:00:14 2013 -0500

    GOPixbuf: handle crazy rowstride.

 ChangeLog                 |    5 +++++
 NEWS                      |    1 +
 goffice/utils/go-pixbuf.c |    7 +++++--
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0505e18..f5c5d3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-19  Morten Welinder  <terra gnome org>
+
+       * goffice/utils/go-pixbuf.c (go_pixbuf_load_attr): Handle crazy
+       rowstride.  Attempt at a fix for #712663.
+
 2013-11-10  Morten Welinder  <terra gnome org>
 
        * goffice/math/go-quad.c (pi_hex_digits, ...): Keep one copy only,
diff --git a/NEWS b/NEWS
index aebd313..9ca60f7 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.10.9:
 
 Morten:
        * Improvements to quad precision code.
+       * Fuzzed file isuues.  [#712663]
 
 --------------------------------------------------------------------------
 goffice 0.10.8:
diff --git a/goffice/utils/go-pixbuf.c b/goffice/utils/go-pixbuf.c
index cb83d7a..b872e2b 100644
--- a/goffice/utils/go-pixbuf.c
+++ b/goffice/utils/go-pixbuf.c
@@ -102,8 +102,11 @@ go_pixbuf_load_attr (GOImage *image, xmlChar const *attr_name, xmlChar const *at
 {
        GOPixbuf *pixbuf = GO_PIXBUF (image);
        g_return_if_fail (pixbuf);
-       if (!strcmp (attr_name, "rowstride"))
-               pixbuf->rowstride = strtol (attr_value, NULL, 10);
+       if (!strcmp (attr_name, "rowstride")) {
+               long l = strtol (attr_value, NULL, 10);
+               g_return_if_fail (l > 0 && l < G_MAXINT);
+               pixbuf->rowstride = l;
+       }
 }
 
 static void


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