aboutsummaryrefslogtreecommitdiffstats
path: root/table.c
diff options
context:
space:
mode:
authorDavid Crosby <dave@dafyddcrosby.com>2015-09-06 00:47:12 +0000
committerTatsuya Kinoshita <tats@debian.org>2015-09-06 11:58:20 +0000
commit85fe99064287b6ee9a373b120ff19f044cb468ec (patch)
tree2a1065d8cbf4e09100e7e7dc75eb72a76ba46e3e /table.c
parentUpdate ChangeLog (diff)
downloadw3m-85fe99064287b6ee9a373b120ff19f044cb468ec.tar.gz
w3m-85fe99064287b6ee9a373b120ff19f044cb468ec.zip
Fix stack overflow found by @kcwu
Diffstat (limited to '')
-rw-r--r--table.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/table.c b/table.c
index b77f0f8..2a0aa8f 100644
--- a/table.c
+++ b/table.c
@@ -188,7 +188,7 @@ dv2sv(double *dv, short *iv, int size)
indexarray = NewAtom_N(short, size);
edv = NewAtom_N(double, size);
for (i = 0; i < size; i++) {
- iv[i] = ceil(dv[i]);
+ iv[i] = (short) ceil(dv[i]);
edv[i] = (double)iv[i] - dv[i];
}
@@ -205,7 +205,7 @@ dv2sv(double *dv, short *iv, int size)
indexarray[i] = k;
}
iw = min((int)(w + 0.5), size);
- if (iw == 0)
+ if (iw <= 1)
return;
x = edv[(int)indexarray[iw - 1]];
for (i = 0; i < size; i++) {