[gnumeric] sc: fix crash on bogus file.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] sc: fix crash on bogus file.
- Date: Mon, 15 Jul 2013 18:32:55 +0000 (UTC)
commit 3404e4e4046ee1154e48914adb97d79d008e2cca
Author: Morten Welinder <terra gnome org>
Date: Mon Jul 15 14:32:42 2013 -0400
sc: fix crash on bogus file.
NEWS | 1 +
plugins/sc/ChangeLog | 5 +++++
plugins/sc/sc.c | 4 +++-
3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 042be8c..d94e746 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Andreas:
Morten:
* Fix crazy parsing problem. [#704109] [#704140]
+ * Fix crashes on corrupted files. [#704102]
--------------------------------------------------------------------------
Gnumeric 1.12.4
diff --git a/plugins/sc/ChangeLog b/plugins/sc/ChangeLog
index b47d150..be3325e 100644
--- a/plugins/sc/ChangeLog
+++ b/plugins/sc/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-15 Morten Welinder <terra gnome org>
+
+ * sc.c (sc_parse_format_set_type): Guard against bogus format.
+ Fixes #704102.
+
2013-07-10 Morten Welinder <terra gnome org>
* Release 1.12.4
diff --git a/plugins/sc/sc.c b/plugins/sc/sc.c
index 46742f9..362e734 100644
--- a/plugins/sc/sc.c
+++ b/plugins/sc/sc.c
@@ -464,7 +464,9 @@ sc_parse_format_apply_precision (ScParseState *state, char *format, int col)
static void
sc_parse_format_set_type (ScParseState *state, int type, int col_from, int col_to)
{
- char const *o_format = g_ptr_array_index(state->formats, type);
+ char const *o_format = type >= 0 && (size_t)type < state->formats->len
+ ? g_ptr_array_index(state->formats, type)
+ : NULL;
int col;
if (o_format == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]