[libgxps] gxps-page: Make gxps_dash_array_parse fail for an odd number of dashes



commit 189336ef928ba7bf9a70562fca18e5a61144814a
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Tue Nov 26 09:16:33 2013 +0100

    gxps-page: Make gxps_dash_array_parse fail for an odd number of dashes
    
    Spotted by Lukas Lueg.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=715023

 libgxps/gxps-page.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index 059d1fd..85035b5 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -218,8 +218,13 @@ gxps_dash_array_parse (const gchar *dash,
                return FALSE;
 
        num_dashes = g_strv_length (items);
-       dashes = g_malloc (num_dashes * sizeof (gdouble));
+        if (num_dashes % 2 != 0) {
+                g_strfreev (items);
+
+                return FALSE;
+        }
 
+       dashes = g_malloc (num_dashes * sizeof (gdouble));
        for (i = 0; i < num_dashes; i++) {
                 if (!gxps_value_get_double (items[i], &dashes[i])) {
                         g_free (dashes);


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