summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-02-07 19:22:00 -0800
committerFather Chrysostomos <sprout@cpan.org>2015-02-07 19:22:00 -0800
commiteea89386b3fb948a8b1eb5ea860ec0a970c9e559 (patch)
tree9ef2b1c60f57ea3d8a457f6a0fb8b9bc46b76a84 /t/op
parent218721242848e642c0d1399644b6a90969e485e3 (diff)
downloadperl-eea89386b3fb948a8b1eb5ea860ec0a970c9e559.tar.gz
[perl #123753] Assert fail with &{+foo} and errors
This fixes the problem mentioned in 3c47da3c2e with an op address being used as flags. '&' not followed by a identifier was being fed to the parser with a stale token value, left over from the previous token that had a value, which might be an op address. This would cause the flags on the op to vary randomly. Usually the rv2cv op created this way is nulled, but if there is a syntax error it may be freed before that happens. And it is when the op is freed that the private flags are checked to make sure no invalid flags have been set. The test added to t/op/lex.t used to fail an assertion (for me) more than half the time, but not always, because the 0x10 bit was being set in op_private (rv2cv does not use that bit).
Diffstat (limited to 't/op')
-rw-r--r--t/op/lex.t14
1 files changed, 12 insertions, 2 deletions
diff --git a/t/op/lex.t b/t/op/lex.t
index 07cdccad37..762d88830b 100644
--- a/t/op/lex.t
+++ b/t/op/lex.t
@@ -7,7 +7,7 @@ use warnings;
BEGIN { chdir 't' if -d 't'; require './test.pl'; }
-plan(tests => 16);
+plan(tests => 17);
{
no warnings 'deprecated';
@@ -129,7 +129,7 @@ fresh_perl_is(
'* <null> ident'
);
SKIP: {
- skip "Different output on EBCDIC (presumably)", 1 if ord("A") != 65;
+ skip "Different output on EBCDIC (presumably)", 2 if ord("A") != 65;
fresh_perl_is(
qq'"ab}"ax;&\0z\x8Ao}\x82x;', <<gibberish,
Bareword found where operator expected at - line 1, near ""ab}"ax"
@@ -140,4 +140,14 @@ gibberish
{ stderr => 1 },
'gibberish containing &\0z - used to crash [perl #123753]'
);
+ fresh_perl_is(
+ qq'"ab}"ax;&{+z}\x8Ao}\x82x;', <<gibberish,
+Bareword found where operator expected at - line 1, near ""ab}"ax"
+ (Missing operator before ax?)
+syntax error at - line 1, near ""ab}"ax"
+Unrecognized character \\x8A; marked by <-- HERE after }"ax;&{+z}<-- HERE near column 14 at - line 1.
+gibberish
+ { stderr => 1 },
+ 'gibberish containing &{+z} - used to crash [perl #123753]'
+ );
}