[gnumeric] sheet_foreach_cell_in_range: avoid overflow.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] sheet_foreach_cell_in_range: avoid overflow.
- Date: Tue, 16 Jul 2013 16:01:22 +0000 (UTC)
commit d320943cac286c5cd5eac265af1c9202e4b96efb
Author: Morten Welinder <terra gnome org>
Date: Tue Jul 16 12:00:45 2013 -0400
sheet_foreach_cell_in_range: avoid overflow.
ChangeLog | 5 +++++
NEWS | 2 +-
src/sheet.c | 4 ++--
3 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f85b8c8..db36cef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-16 Morten Welinder <terra gnome org>
+
+ * src/sheet.c (sheet_foreach_cell_in_range): Avoid overflow when
+ computing range size. Fixes #704325.
+
2013-07-15 Morten Welinder <terra gnome org>
* src/mstyle.c (gnm_style_cmp): Borders can be NULL; deal with
diff --git a/NEWS b/NEWS
index a01e313..409d2e1 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ Andreas:
Morten:
* Fix crazy parsing problem. [#704109] [#704140]
- * Fix crashes on corrupted files. [#704102] [#704004]
+ * Fix crashes on corrupted files. [#704102] [#704004] [#704325]
--------------------------------------------------------------------------
Gnumeric 1.12.4
diff --git a/src/sheet.c b/src/sheet.c
index bb6542d..1d03996 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -3860,7 +3860,7 @@ sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
gboolean const ignore_empty = (flags & CELL_ITER_IGNORE_EMPTY) != 0;
gboolean ignore;
gboolean use_celllist;
- size_t range_size;
+ guint64 range_size;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (callback != NULL, NULL);
@@ -3882,7 +3882,7 @@ sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
start_row = MAX (0, start_row);
end_row = MIN (end_row, gnm_sheet_get_last_row (sheet));
- range_size = (end_row - start_row + 1) * (end_col - start_col + 1);
+ range_size = (guint64)(end_row - start_row + 1) * (end_col - start_col + 1);
use_celllist =
only_existing &&
range_size > g_hash_table_size (sheet->cell_hash) + 1000;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]