summaryrefslogtreecommitdiff
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorVibhav Pant <vibhavp@gmail.com>2017-01-19 18:35:46 +0530
committerVibhav Pant <vibhavp@gmail.com>2017-01-19 18:35:46 +0530
commit522f16dac945eee351cefb066af40f0d1a683f38 (patch)
treec86d7297a1efcc341ccd266be66486129556cfc4 /src/bytecode.c
parent1fcbd352f8116aca1ecdb62e84f3d86b89bc446f (diff)
downloademacs-522f16dac945eee351cefb066af40f0d1a683f38.tar.gz
Add type checking for Bswitch, when enabled at compile time.
* src/bytecode.c: (exec_byte_code) If BYTE_CODE_SAFE is enabled at compile time, use CHECK_TYPE to verify that the jump table is a hash table.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index fc434a2812f..f4540e94c9c 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1417,6 +1417,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
{
Lisp_Object jmp_table = POP;
Lisp_Object v1 = POP;
+#ifdef BYTE_CODE_SAFE
+ CHECK_TYPE (HASH_TABLE_P (jmp_table), Qhash_table_p, jmp_table);
+#endif
struct Lisp_Hash_Table *h = XHASH_TABLE(jmp_table);
ptrdiff_t i = hash_lookup(h, v1, NULL);
if (i >= 0) {