From 177eefa3bde9145cc502fc9b58df690014e3a150 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 7 Aug 1998 05:39:41 +0000 Subject: [PATCH] add some check for invalid values git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@937 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/table-allgui.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index 2356d1be5e..3428b99cd7 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -288,8 +288,15 @@ xaccSetCursor (Table *table, CellBlock *curs, { int i,j; - /* hack alert -- should check to make sure that no null pointers - * or bad values were passed in ... */ + /* reject various bad values that might get passed in */ + if ((!table) || (!curs)) return; + if ((0 > phys_row_origin) || (0 > phys_col_origin)) return; + if (phys_row_origin >= table->num_phys_rows) return; + if (phys_col_origin >= table->num_phys_cols) return; + + if ((0 > virt_row) || (0 > virt_col)) return; + if (virt_row >= table->num_virt_rows) return; + if (virt_col >= table->num_virt_cols) return; /* this cursor is the handler for this block */ table->handlers[virt_row][virt_col] = curs;