From 43295bdd62998d434f244e925ca6db1af4cb77fb Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Tue, 26 Nov 2002 07:10:18 +0000 Subject: w3m 0.3.2 branch: backport from trunk * [w3m-dev 03438] Re: segmentation fault by large complex table. * table.c (check_table_height): check MAXROWCELL * table.h (MAXROWCELL): added From: Hironori SAKAMOTO --- ChangeLog | 9 ++++++++- table.c | 4 +++- table.h | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a87a05d..43a952d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-11-16 Hironori SAKAMOTO + + * w3m 0.3.2 branch: backport from trunk + * [w3m-dev 03438] Re: segmentation fault by large complex table. + * table.c (check_table_height): check MAXROWCELL + * table.h (MAXROWCELL): added + 2002-11-26 Hironori SAKAMOTO * w3m 0.3.2 branch: backport from trunk @@ -4114,4 +4121,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.467.4.1 2002/11/26 07:09:09 ukai Exp $ +$Id: ChangeLog,v 1.467.4.2 2002/11/26 07:10:18 ukai Exp $ diff --git a/table.c b/table.c index 6949b3b..fd3e36b 100644 --- a/table.c +++ b/table.c @@ -1,4 +1,4 @@ -/* $Id: table.c,v 1.27.4.1 2002/11/26 07:09:09 ukai Exp $ */ +/* $Id: table.c,v 1.27.4.2 2002/11/26 07:10:18 ukai Exp $ */ /* * HTML table */ @@ -1518,6 +1518,8 @@ check_table_height(struct table *t) if (cell.row[idx] == j && cell.rowspan[idx] == rowspan) c = idx; } + if (c >= MAXROWCELL) + continue; if (c >= cell.size) { if (cell.size == 0) { cell.size = max(MAXCELL, c + 1); diff --git a/table.h b/table.h index 989969e..c3cf96c 100644 --- a/table.h +++ b/table.h @@ -1,4 +1,4 @@ -/* $Id: table.h,v 1.5.6.1 2002/11/26 07:09:09 ukai Exp $ */ +/* $Id: table.h,v 1.5.6.2 2002/11/26 07:10:18 ukai Exp $ */ #if (defined(MESCHACH) && !defined(MATRIX)) #define MATRIX #endif /* (defined(MESCHACH) && !defined(MATRIX)) */ @@ -34,6 +34,7 @@ typedef unsigned short table_attr; #define TBL_IN_COL 4 #define MAXCELL 20 +#define MAXROWCELL 1000 struct table_cell { short col[MAXCELL]; short colspan[MAXCELL]; -- cgit v1.2.3