[gnumeric] xlsx: parse bogus firstPageNumber=-1



commit 9d83784c3711cf116a04bc0b346a502046f8f120
Author: Morten Welinder <terra gnome org>
Date:   Mon Jan 31 12:42:39 2022 -0500

    xlsx: parse bogus firstPageNumber=-1
    
    It's supposedly unsigned.

 plugins/excel/xlsx-read.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 679c197ad..866e8f060 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -2022,7 +2022,15 @@ xlsx_CT_PageSetup (GsfXMLIn *xin, xmlChar const **attrs)
                        ;
                else if (attr_bool (xin, attrs, "draft", &tmp_bool))
                        pi->print_as_draft = tmp_bool;
-               else if (attr_uint (xin, attrs, "firstPageNumber", &first_page))
+               else if (strcmp (attrs[0], "firstPageNumber") == 0 &&
+                        attrs[1][0] == '-') {
+                       // Supposed to be unsigned but we see a negative.
+                       // Parse and then see -1 (which will map to don't-use
+                       // a few steps down the line).
+                       int p = -1;
+                       (void)attr_int (xin, attrs, "firstPageNumber", &p);
+                       first_page = (unsigned)-1;
+               } else if (attr_uint (xin, attrs, "firstPageNumber", &first_page))
                        ;
                else if (attr_int (xin, attrs, "fitToHeight", &(pi->scaling.dim.rows)))
                        ;


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