From e045d73df1ca72421bb4c37b830713cdef6df989 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 31 May 1998 00:47:04 +0000 Subject: [PATCH] validate cursor relative addressing git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@856 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/table-gtk.c | 9 ++++++++- src/register/table-motif.c | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/register/table-gtk.c b/src/register/table-gtk.c index 020bf55375..e644b95796 100644 --- a/src/register/table-gtk.c +++ b/src/register/table-gtk.c @@ -175,7 +175,14 @@ verify_cell_interaction_OK(Table *table, const int row, const int col) /* compute the cell location */ rel_row = table->locators[row][col]->phys_row_offset; rel_col = table->locators[row][col]->phys_col_offset; - + + /* verify that cursor offsets are valid. This may occur if + * the app that is using the table has a paritally initialized + * cursor. (probably due to a prograing error, but maybe they + * meant to do this). */ + invalid = invalid || (0 > rel_row); + invalid = invalid || (0 > rel_col); + /* check for a cell handler, but only if cell adress is valid */ /* GTK may not need all these checks, but they don't hurt */ if (arr && !invalid) { diff --git a/src/register/table-motif.c b/src/register/table-motif.c index fadf76e3da..ff616f2a36 100644 --- a/src/register/table-motif.c +++ b/src/register/table-motif.c @@ -172,6 +172,13 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb) rel_row = table->locators[row][col]->phys_row_offset; rel_col = table->locators[row][col]->phys_col_offset; + /* verify that cursor offsets are valid. This may occur if + * the app that is using the table has a paritally initialized + * cursor. (probably due to a prograing error, but maybe they + * meant to do this). */ + invalid = invalid || (0 > rel_row); + invalid = invalid || (0 > rel_col); + /* check for a cell handler, but only if cell adress is valid */ if (arr && !invalid) { if (! (arr->cells[rel_row][rel_col])) {