summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-13 21:59:52 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-13 21:59:52 +0000
commit93d343c6c59d1d6b5e6307c31585c77ab830183d (patch)
tree0b9d25fd044eff0a94484ec9596ad6538883596f /ext
parent3b0527feddb0a07bea3ee32931f209fea87152bc (diff)
downloadperl-93d343c6c59d1d6b5e6307c31585c77ab830183d.tar.gz
(Hopefully) fix coredumps in ByteLoader, which were a side effect of
fixing a bug in B, and non-robust autogenerated code. When autogenerating initialiser statements for an array, it's a bad plan to have the size of that array hard coded. p4raw-id: //depot/perl@27795
Diffstat (limited to 'ext')
-rw-r--r--ext/ByteLoader/bytecode.h6
-rw-r--r--ext/ByteLoader/byterun.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h
index 7ba0236313..1d06b08877 100644
--- a/ext/ByteLoader/bytecode.h
+++ b/ext/ByteLoader/bytecode.h
@@ -91,7 +91,11 @@ typedef char *pvindex;
arg = arg ? savepv(arg) : arg; \
} STMT_END
-#define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg]
+#define BSET_ldspecsv(sv, arg) STMT_START { \
+ assert(arg < sizeof(specialsv_list) / sizeof(specialsv_list[0])); \
+ sv = specialsv_list[arg]; \
+ } STMT_END
+
#define BSET_ldspecsvx(sv, arg) STMT_START { \
BSET_ldspecsv(sv, arg); \
BSET_OBJ_STOREX(sv); \
diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c
index c8543f7ffe..77568ba2c6 100644
--- a/ext/ByteLoader/byterun.c
+++ b/ext/ByteLoader/byterun.c
@@ -51,7 +51,7 @@ byterun(pTHX_ register struct byteloader_state *bstate)
dVAR;
register int insn;
U32 ix;
- SV *specialsv_list[6];
+ SV *specialsv_list[7];
BYTECODE_HEADER_CHECK; /* croak if incorrect platform */
Newx(bstate->bs_obj_list, 32, void*); /* set op objlist */