[gnumeric] Fix null pointer dereference.



commit 9648d386edeb6c1cca7f799e65556393cc620e49
Author: J.H.M. Dassen (Ray) <jdassen debian org>
Date:   Fri Sep 17 13:05:28 2010 +0200

    Fix null pointer dereference.
    
    When expr_len == 0 (which seems to indicate a placeholder for an unknown
    name), texpr wasn't changed from its initial NULL value, leading to a null
    pointer dereference down the road. Have it point to a #NAME instead.

 plugins/excel/ms-excel-read.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 351c8a4..7ceecdc 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -3357,8 +3357,10 @@ excel_parse_name (GnmXLImporter *importer, Sheet *sheet, char *name,
 
 	parse_pos_init (&pp, importer->wb, sheet, 0, 0);
 
-	/* expr_len == 0 seems to indicate a placeholder for an unknown name */
-	if (expr_len != 0) {
+	if (expr_len == 0) {
+		/* This seems to indicate a placeholder for an unknown name */
+		texpr = gnm_expr_top_new_constant (value_new_error_NAME (NULL));
+	} else {
 		texpr = excel_parse_formula (&importer->container, NULL, 0, 0,
 					     expr_data, expr_len, 0 /* FIXME? */,
 					     TRUE, NULL);



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