diff options
author | Karl Williamson <khw@cpan.org> | 2019-04-26 14:42:37 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-05-02 09:26:06 -0600 |
commit | b7b52646bdd14487f27b3cbf58bf526fbaee140f (patch) | |
tree | 6452103249b59b34f36975a227faf8e838824e2d /t | |
parent | 9ddfdb573eecc4201e23e59c82335dbdd9e7c7d3 (diff) | |
download | perl-b7b52646bdd14487f27b3cbf58bf526fbaee140f.tar.gz |
PATCH: [perl #134064] Assertion failure in toke.c
The blamed commit simplified some code based on the assumption that
UTF-8 well-formedness had already been verified. It had an assertion to
verify this. The test case shows that there is a path, through 'eval',
that bypasses this usual checking.
The checking was based on the assumption that the program started not in
UTF-8, and something like a 'use utf8' would be needed to get it there,
at which point a flag would be set to the effect that well-formedness
should be checked. But it turns out that a string eval (perhaps other
things) gets parsed separately and so the flag wasn't set, so no
well-formedness checking was being done.
The solution is a one word change, to initialize the flag to TRUE "'yes,
check" instead of FALSE "no, don't check" in the initialization routine
run at the beginning of lexing a code unit. This catches eval and
presumably anything else that was being bypassed.
The checking is only actually done if the code being lexed is known to
be in UTF-8. This will continue to get turned on by the ways it
currently gets turned on, such as 'use utf8'.
Diffstat (limited to 't')
-rw-r--r-- | t/lib/warnings/toke | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index faaf5bc6b8..83641e5106 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -1675,3 +1675,19 @@ Execution of - aborted due to compilation errors. use utf8; qw∘foo ∞ ♥ bar∘ EXPECT +######## +# NAME [perl #134064] +BEGIN { + if (ord('A') == 193) { + print "SKIPPED\n# test is ASCII-specific, but could be extended to EBCDIC"; + exit 0; + } +} +use utf8; +$foo="m'\302'"; +eval $foo ; +print "The eval did not crash the program\n" +EXPECT +OPTION regex +Malformed UTF-8 character: .*non-continuation.* +The eval did not crash the program |