From: Jean Privat Date: Tue, 26 May 2015 18:43:16 +0000 (-0400) Subject: sepcomp: fix hardening related to the instantiation of dead types X-Git-Tag: v0.7.5~23^2 X-Git-Url: http://nitlanguage.org sepcomp: fix hardening related to the instantiation of dead types Signed-off-by: Jean Privat --- diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 085a36d..7231bbb 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -768,7 +768,8 @@ class SeparateCompiler end v.add_decl("\},") else - v.add_decl("0, \{\}, /*DEAD TYPE*/") + # Use -1 to indicate dead type, the info is used by --hardening + v.add_decl("-1, \{\}, /*DEAD TYPE*/") end v.add_decl("\};") end @@ -1036,7 +1037,7 @@ class SeparateCompiler v.add("if({t} == NULL) \{") v.add_abort("type null") v.add("\}") - v.add("if({t}->table_size == 0) \{") + v.add("if({t}->table_size < 0) \{") v.add("PRINT_ERROR(\"Insantiation of a dead type: %s\\n\", {t}->name);") v.add_abort("type dead") v.add("\}")