diff options
author | Mura Li <mural@ctli.io> | 2020-12-01 06:14:55 +0000 |
---|---|---|
committer | Mura Li <mural@ctli.io> | 2020-12-01 06:14:55 +0000 |
commit | d4030509dc5ebcfb8e3922ab01bda9ada8cd094d (patch) | |
tree | 0c88e511fded467d0cf90a0b578a3023923899d6 | |
parent | f3109e1faf8de6f98c308aabba79e8db0c0876dd (diff) | |
download | mc-master.tar.gz |
Previously, a blob of size N, where N is a power of 2, will be placed into the
2N-sized bucket. It turns out that the 128 KiB allocation will be assigned to a
non-existent 256 KiB bucket and crash the program.
Signed-off-by: Mura Li <mural@ctli.io>
-rw-r--r-- | lib/std/bytealloc.myr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/bytealloc.myr b/lib/std/bytealloc.myr index 4cd2b67..c16761d 100644 --- a/lib/std/bytealloc.myr +++ b/lib/std/bytealloc.myr @@ -405,7 +405,7 @@ const bitpos : byte[32] = [ const bktnum = {sz var n, v - v = (sz >> 3 : uint32) + v = sz > 0 ? ((sz - 1) >> 3 : uint32) : 0 v |= v >> 1 v |= v >> 2 v |= v >> 4 |