From adde6c2da7b1e45f7a2de71c151d690b9c52ebf9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 1 Aug 2019 12:00:33 -0700 Subject: [PATCH] Correct base calculation in anyref allocator This `base` value is the raw value coming out of the first call to `table.grow`. Throwing in the addition of `JSIDX_RESERVED` just wasn't right! --- src/anyref.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/anyref.rs b/src/anyref.rs index 47d8502a..7edff7db 100644 --- a/src/anyref.rs +++ b/src/anyref.rs @@ -39,7 +39,7 @@ impl Slab { internal_error("table grow failure") } if self.base == 0 { - self.base = r as usize + (super::JSIDX_RESERVED as usize); + self.base = r as usize; } else if self.base + self.data.len() != r as usize { internal_error("someone else allocated table entires?") }