diff options
author | yuta.256 <yuta.256@b7c3aa3b-274f-0410-ae0b-edc9d07c929d> | 2008-07-18 19:30:31 +0000 |
---|---|---|
committer | yuta.256 <yuta.256@b7c3aa3b-274f-0410-ae0b-edc9d07c929d> | 2008-07-18 19:30:31 +0000 |
commit | f6a102a6c865e0c593e3d296d11ad340a581711b (patch) | |
tree | 57c774e29276f2bb27486f6af8d99850e13ee409 /lib | |
parent | 101c19ff41d3cebfb3702ce980d02a09f81e2e0b (diff) | |
download | libdivsufsort-f6a102a6c865e0c593e3d296d11ad340a581711b.tar.gz |
Fixed integer overflow in ss_isqrt().
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sssort.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sssort.c b/lib/sssort.c index 037ac97..79ab181 100644 --- a/lib/sssort.c +++ b/lib/sssort.c @@ -84,7 +84,7 @@ ss_ilg(saidx_t n) { #if SS_BLOCKSIZE != 0 -static const int sqq_table[256] = { +static const saint_t sqq_table[256] = { 0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, @@ -108,7 +108,7 @@ saidx_t ss_isqrt(saidx_t x) { saidx_t y, e; - if(x >= (65535UL * 65535UL)) { return 65535; } + if(x >= (SS_BLOCKSIZE * SS_BLOCKSIZE)) { return SS_BLOCKSIZE; } e = (x & 0xffff0000) ? ((x & 0xff000000) ? 24 + lg_table[(x >> 24) & 0xff] : |