Skip to content

Commit

Permalink
[perl #123711] Fix crash with 0-5x-l{0}
Browse files Browse the repository at this point in the history
perl-5.8.0-117-g6f33ba7, which added the XTERMORDORDOR hack, did not
change the leftbracket code to treat XTERMORDORDOR the same way as
XTERM, so -l {0} and getc {0} (among other ops) were treating {...} as
a block, rather than an anonymous hash.  This was not, however, being
turned into a real block with enter/leave ops to protect the stack,
so the nextstate op was corrupting the stack and possibly freeing mor-
tals in use.

This commit makes the leftbracket code check for XTERMORDORDOR and
treat it like XTERM, so that -l {0} once more creates an anonymous
hash.  There is really no way to get to that hash, though, so all I
can test for is the crash.
  • Loading branch information
Father Chrysostomos committed Feb 1, 2015
1 parent 47fb243 commit 83a85f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions t/base/lex.t
Expand Up @@ -482,3 +482,6 @@ print "not " unless &{sub :lvalue { "a" }} eq "a";
print "ok $test - &{sub :lvalue...}\n"; $test++;
print "not " unless ref +(map{sub :lvalue { "a" }} 1)[0] eq "CODE";
print "ok $test - map{sub :lvalue...}\n"; $test++;
# Used to crash [perl #123711]
0-5x-l{0};
1 change: 1 addition & 0 deletions toke.c
Expand Up @@ -5506,6 +5506,7 @@ Perl_yylex(pTHX)
}
switch (PL_expect) {
case XTERM:
case XTERMORDORDOR:
PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
PL_lex_allbrackets++;
OPERATOR(HASHBRACK);
Expand Down

0 comments on commit 83a85f4

Please sign in to comment.