[gnumeric] workbook: fix crash.



commit 0db65eac8470c9f05d2a0e75632aa0ac6b3afa14
Author: Morten Welinder <terra gnome org>
Date:   Tue Aug 3 20:56:34 2010 -0400

    workbook: fix crash.

 ChangeLog      |    2 ++
 src/workbook.c |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e272e76..fb659ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-08-03  Morten Welinder  <terra gnome org>
 
+	* src/workbook.c (workbook_sheet_by_index): Fix crash.  [#625985]
+
 	* src/gnm-random.c (random_01_device): Read the right number of
 	new bytes, just in case.
 
diff --git a/src/workbook.c b/src/workbook.c
index dbf8d47..4e6308d 100644
--- a/src/workbook.c
+++ b/src/workbook.c
@@ -730,7 +730,8 @@ Sheet *
 workbook_sheet_by_index (Workbook const *wb, int i)
 {
 	g_return_val_if_fail (IS_WORKBOOK (wb), NULL);
-	g_return_val_if_fail ((int)wb->sheets->len > i, NULL);
+	g_return_val_if_fail (i < (int)wb->sheets->len, NULL);
+	g_return_val_if_fail (i >= -1, NULL);
 
 	/* i = -1 is special, return NULL */
 



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