aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-11-12 13:19:12 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-11-12 13:50:01 +0000
commitf393faf55975a94217df479e1bd06ee4403c6958 (patch)
tree584f0c7827f5aeba6e74d7bcc0048e719e9c425f
parentUpdate ChangeLog (diff)
downloadw3m-f393faf55975a94217df479e1bd06ee4403c6958.tar.gz
w3m-f393faf55975a94217df479e1bd06ee4403c6958.zip
Prevent infinite recursion with nested table and textarea
Bug-Debian: https://github.com/tats/w3m/issues/20
Diffstat (limited to '')
-rw-r--r--table.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/table.c b/table.c
index 33593b1..53b43b7 100644
--- a/table.c
+++ b/table.c
@@ -1632,6 +1632,19 @@ renderCoTable(struct table *tbl, int maxlimit)
struct table *t;
int i, col, row;
int indent, maxwidth;
+ static struct table *tbl_prev = NULL;
+ static int cotbl_count;
+#define MAX_COTABLE 100
+
+ if (tbl == NULL)
+ return;
+ if (tbl != tbl_prev) {
+ tbl_prev = tbl;
+ cotbl_count = 0;
+ }
+ if (cotbl_count >= MAX_COTABLE)
+ return; /* workaround to prevent infinite recursion */
+ cotbl_count++;
for (i = 0; i < tbl->ntable; i++) {
t = tbl->tables[i].ptr;