diff options
author | David Crosby <dave@dafyddcrosby.com> | 2015-09-06 00:47:12 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2015-09-06 11:58:20 +0000 |
commit | 85fe99064287b6ee9a373b120ff19f044cb468ec (patch) | |
tree | 2a1065d8cbf4e09100e7e7dc75eb72a76ba46e3e | |
parent | Update ChangeLog (diff) | |
download | w3m-85fe99064287b6ee9a373b120ff19f044cb468ec.tar.gz w3m-85fe99064287b6ee9a373b120ff19f044cb468ec.zip |
Fix stack overflow found by @kcwu
-rw-r--r-- | table.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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++) { |