[gnumeric] Protect against crash of 637142
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Protect against crash of 637142
- Date: Sun, 26 Dec 2010 23:33:20 +0000 (UTC)
commit dd0e5b2f0aace7d7ea04b19a7e87644456bdf533
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sun Dec 26 16:31:29 2010 -0700
Protect against crash of 637142
2010-12-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/go-data-cache-field.c (go_data_cache_field_get_val): protect
against crashes
ChangeLog | 5 +++++
src/go-data-cache-field.c | 15 ++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5a09ad6..122096e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-12-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/go-data-cache-field.c (go_data_cache_field_get_val): protect
+ against crashes
+
2010-12-26 Jean Brefort <jean brefort normalesup org>
* src/sheet-control-gui.c (scg_scale_changed): reposition sheet objects to
diff --git a/src/go-data-cache-field.c b/src/go-data-cache-field.c
index 62ed573..2b0d6d9 100644
--- a/src/go-data-cache-field.c
+++ b/src/go-data-cache-field.c
@@ -215,9 +215,18 @@ go_data_cache_field_get_val (GODataCacheField const *field, unsigned int record_
switch (field->ref_type) {
case GO_DATA_CACHE_FIELD_TYPE_NONE : return NULL;
case GO_DATA_CACHE_FIELD_TYPE_INLINE : return *((GOVal **)p);
- case GO_DATA_CACHE_FIELD_TYPE_INDEXED_I8 : idx = *(guint8 *)p; break;
- case GO_DATA_CACHE_FIELD_TYPE_INDEXED_I16 : idx = *(guint16 *)p; break;
- case GO_DATA_CACHE_FIELD_TYPE_INDEXED_I32 : idx = *(guint32 *)p; break;
+ case GO_DATA_CACHE_FIELD_TYPE_INDEXED_I8 :
+ g_return_val_if_fail (field->offset > 0, NULL);
+ idx = *(guint8 *)p;
+ break;
+ case GO_DATA_CACHE_FIELD_TYPE_INDEXED_I16 :
+ g_return_val_if_fail (field->offset > 0, NULL);
+ idx = *(guint16 *)p;
+ break;
+ case GO_DATA_CACHE_FIELD_TYPE_INDEXED_I32 :
+ g_return_val_if_fail (field->offset > 0, NULL);
+ idx = *(guint32 *)p;
+ break;
default :
g_warning ("unknown field type %d", field->ref_type);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]