From 1cd0019b3f48232fdcc2ebd5e0c181bdc49e0088 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julien=20Pag=C3=A8s?= Date: Fri, 18 Jul 2014 16:24:23 +0200 Subject: [PATCH] nitvm: fix a crash caused by a bad allocation of virtual tables MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Pagès --- src/vm.nit | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vm.nit b/src/vm.nit index eed0d47..0cb7961 100644 --- a/src/vm.nit +++ b/src/vm.nit @@ -405,8 +405,9 @@ class MemoryManager total_size += 2; } - // Add the size of the perfect hashtable - total_size += mask+1; + // Add the size of the perfect hashtable (mask +1) + // Add one because we start to fill the vtable at position 1 (0 is the init position) + total_size += mask+2; long unsigned int* vtable = malloc(sizeof(long unsigned int)*total_size); // Initialisation to the first position of the virtual table (ie : Object) -- 1.7.9.5