From d1bfb649a8c4cc0b39b0fd6371c009b71c0b497f Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Sun, 6 Feb 2011 14:34:49 +0000 Subject: [PATCH] many string evals cause eventual scope issues [perl #83364]. PL_cop_seqmax is U32 but PAD_MAX was defined as I32_MAX. Once PL_cop_seqmax got above 2 billion it would start to appear spuriosuly as if PL_cop_seqmax > PAD_MAX, so the scope of lexical vars in evals etc went awry. Also replaces a use of ~0 with PAD_MAX, which shouldn't change anything, but is just tidier. --- pad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pad.c b/pad.c index de462c7254df..86884bfaf349 100644 --- a/pad.c +++ b/pad.c @@ -128,7 +128,7 @@ For state vars, SVs_PADSTALE is overloaded to mean 'not yet initialised' #define PARENT_FAKELEX_FLAGS_set(sv,val) \ STMT_START { ((XPVNV*)SvANY(sv))->xnv_u.xpad_cop_seq.xhigh = (val); } STMT_END -#define PAD_MAX I32_MAX +#define PAD_MAX U32_MAX #ifdef PERL_MAD void pad_peg(const char* s) { @@ -591,7 +591,7 @@ Perl_pad_add_anon(pTHX_ SV* sv, OPCODE op_type) pad_peg("add_anon"); sv_setpvs(name, "&"); /* Are these two actually ever read? */ - COP_SEQ_RANGE_HIGH_set(name, ~0); + COP_SEQ_RANGE_HIGH_set(name, PAD_MAX); COP_SEQ_RANGE_LOW_set(name, 1); ix = pad_alloc(op_type, SVs_PADMY); av_store(PL_comppad_name, ix, name);