This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Zak B. Elep [Thu, 21 Mar 2019 12:54:06 +0000 (20:54 +0800)]
New perldelta for 5.29.10
Zak B. Elep [Thu, 21 Mar 2019 12:35:44 +0000 (20:35 +0800)]
Tick off 5.29.9!
Zak B. Elep [Thu, 21 Mar 2019 12:34:38 +0000 (20:34 +0800)]
Epigraph for 5.29.9
Zak B. Elep [Wed, 20 Mar 2019 20:19:08 +0000 (04:19 +0800)]
Ensure autogenerated files for Devel::PPPort are up to date
`make regen` in dist/Devel-PPPort, thanks ether and Pali for guidance!
Zak B. Elep [Wed, 20 Mar 2019 18:02:55 +0000 (02:02 +0800)]
Add myself to AUTHORS
Zak B. Elep [Wed, 20 Mar 2019 17:52:08 +0000 (01:52 +0800)]
Add 5.29.9 release to pod/perlhist
Zak B. Elep [Wed, 20 Mar 2019 17:39:33 +0000 (01:39 +0800)]
Update perldelta for 5.29.9 release
Zak B. Elep [Wed, 20 Mar 2019 16:57:33 +0000 (00:57 +0800)]
Update Module::CoreList for 5.29.9
Zak B. Elep [Wed, 20 Mar 2019 16:14:52 +0000 (00:14 +0800)]
Fix $JSON::PP::Boolean::VERSION
Match to the correct version of JSON::PP already installed in commit
929e53be972b0c811eca54a3c7017db116f62e4a.
Zak B. Elep [Wed, 20 Mar 2019 15:52:00 +0000 (23:52 +0800)]
Porting/Maintainers.pl: vutil.c is CUSTOMIZED once more
Commit
8633b5394e9f1be292f2b13d5f642a205ae31509 updated vutil.c from the
'version' CPAN distribution but seems to have missed updating the
corresponding Maintainers.pl key; this change also needs pushing to
upstream as well.
Karl Williamson [Wed, 20 Mar 2019 17:47:15 +0000 (11:47 -0600)]
Add common UTF-8 first byte to ANYOFH regnodes
An ANYOFH regnode is generated instead of a plain ANYOF one when
nothing it can match is in the bitmap used in ANYOF nodes. It is
therefore smaller as the 4 word (or more) bitmap is omitted.
This means that for it to match a target string, that string must be
UTF-8 (since the bitmap is for at least the lowest 256 code points).
And only in rare circumstances are there any flags associated with it in
the regnode flags field.
This commit changes things so that the flags field in an ANYOFH node is
repurposed to be the first UTF-8 encoded byte of every code point
matched by the class if there is a common byte for all of them; or 0 if
some have different first bytes.
(That means that those rare cases where the flags field isn't otherwise
empty can no longer be ANYOFH nodes.)
The purpose of this is so that a future commit can take advantage of
this, and more quickly scan the target string for places that this node
can match. A problem with ANYOF nodes is that they are code point
oriented (U32 or U64), and the target string is UTF-8, so conversion has
to be done. By having the partial conversion compiled in, we can look
for that at runtime instead of having to look at every character in the
scan.
Nicolas R [Tue, 19 Mar 2019 20:57:51 +0000 (14:57 -0600)]
Bump Devel::PPPort to keep in sync with CPAN
During Perl 5.29.8 release, Devel-PPPort was uploaded
to CPAN but the distro was incomplete as unit tests
were not part of the submitted tarball.
To fix this, a new 3.45 version was published to CPAN.
This commit, keep blead in sync with this change.
Karl Williamson [Tue, 19 Mar 2019 18:37:04 +0000 (12:37 -0600)]
PATCH: [perl #133937] Assertion failure
This recently added assertion actually caught an error, which is a
potential read beyond end of buffer. This doesn't actually happen in
this case because this is a regular expression pattern, and the toker
makes sure there is a trailing NUL (that isn't counted).
The solution is to check the bounds before reading.
Karl Williamson [Tue, 19 Mar 2019 18:21:49 +0000 (12:21 -0600)]
dquote.c: Prevent possible out-of-bounds read
This code read a byte that was potentially out-of-bounds. I don't know
how it could get this far, but maybe some fuzzing code could get it.
Karl Williamson [Tue, 19 Mar 2019 18:14:26 +0000 (12:14 -0600)]
Change error wording for empty \x{}
An empty \x{} is unfortunately legal (returning a NUL) except in the
scope of "use re 'strict'". Since this is an experimental feature,
things like wording changes are allowed. It is unlikely anyone is
relying on the precise wording of this fatal error under 'strict', and
now all the messages for similar errors are similarly worded.
Karl Williamson [Tue, 19 Mar 2019 18:08:06 +0000 (12:08 -0600)]
Change error wording for \o{}
An empty \o{} no longer says "Number with no digits" in favor of "Empty
\o{}" which is more consistent with errors raised for things like \b{},
\P{}.
There is a small risk of breakage with this change, as with any
diagnostic wording change. However, this construct is relatively new
and rarely used, and this is a fatal error, not a warning you might want
to trap on. There are no empty \o{} instances in CPAN.
Karl Williamson [Tue, 19 Mar 2019 16:25:06 +0000 (10:25 -0600)]
Merge branch 'safer' into blead
I undertook an audit to see where there might be places where malformed
UTF-8 input could cause us to exceed the boundaries of buffers. I
looked for where hopping to other characters in the string and skipping
to the next character based on the current start byte.
This branch is the result of that. Wherever I didn't see how exceeding
the bounds wasn't a problem, I changed to use the safer versions of the
hop and skip operations that we already have. As an example of where it
isn't a problem is when doing the operation is at the end of a loop
iteration, and the loop tests if we've exceeded it, with the result that
the loop just stops executing.
I may have missed things, and may have changed to unnecessarily use the
safer operations in places
Karl Williamson [Mon, 18 Mar 2019 17:02:23 +0000 (11:02 -0600)]
regexec.c: Use safe UTF8SKIP
Karl Williamson [Mon, 18 Mar 2019 17:09:22 +0000 (11:09 -0600)]
regexec.c: Use safer utf8_hop
Karl Williamson [Mon, 18 Mar 2019 16:38:56 +0000 (10:38 -0600)]
regcomp.c: Use safer utf8_hop
Karl Williamson [Tue, 19 Mar 2019 02:16:39 +0000 (20:16 -0600)]
regcomp.c: Use safe UTF8SKIP
Karl Williamson [Tue, 19 Mar 2019 01:48:48 +0000 (19:48 -0600)]
pp_ctl.c: Use safe UTF8SKIP
Karl Williamson [Tue, 19 Mar 2019 01:27:57 +0000 (19:27 -0600)]
pp_pack.c: Use safe UTF8SKIP
Karl Williamson [Mon, 18 Mar 2019 16:29:46 +0000 (10:29 -0600)]
pp.c: Use safer utf8_hop
Karl Williamson [Tue, 19 Mar 2019 03:43:34 +0000 (21:43 -0600)]
regexec.c: Add comments
Karl Williamson [Tue, 19 Mar 2019 03:17:03 +0000 (21:17 -0600)]
pp.c, pp_sys.c: Use DO_UTF8 instead of its expansion
We have a macro to hide the details of this; use it
David Mitchell [Tue, 19 Mar 2019 11:15:21 +0000 (11:15 +0000)]
op_free() remove redundant !kid test
and replace with an assert.
If an op has the OPf_KIDS flag, then cUNOPo->op_first must be non-null.
So testing for !kid doesn't do much, especially as on the previous line
we dereference it anyway.
David Mitchell [Tue, 19 Mar 2019 10:58:46 +0000 (10:58 +0000)]
handle scope error in qr/\(?{/
RT #133879
In this code:
BEGIN {$^H = 0x10000 }; # HINT_NEW_RE
qr/\(?{/
When the toker sees the 'qr', it looks ahead and thinks that the
pattern *might* contain code blocks, so creates a new anon sub to wrap
compilation of the pattern in (so that any code blocks get compiled as
part of the anon sub rather than the main body of the code).
Normally at the end of parsing the qr construct, the parser notes that
no code blocks were found, and throws the unneeded CV away and
restores the old PL_compcv (via a LEAVE_SCOPE). This false positive is
normal and is expected in the relevant code paths.
However, setting the HINT_NEW_RE (which indicates that
overload::constant is present for qr// but with no overloaded function
actually present) causes an error to be raised. The parser does error
recovery and continues.
However, v5.25.9-148-g7c44985626 added a test to not bother compiling a
pattern if the parser is in an errored state, which again is fine,
except it turns out that if this branch is taken, it skips the 'restore
the old PL_compcv' code, leading to the wrong value for PL_compcv when
ops are freed.
The fix is simple: move the "skip if errored" test to after PL_compcv
has been restored.
Karl Williamson [Mon, 18 Mar 2019 17:05:33 +0000 (11:05 -0600)]
Merge branch 'vlb' into blead
This branch implements variable length lookbehind in regular expression
patterns.
Karl Williamson [Mon, 18 Mar 2019 03:47:16 +0000 (21:47 -0600)]
regexec.c: White-space only
Outdent to reflect removed enclosing block
Karl Williamson [Mon, 18 Mar 2019 03:06:10 +0000 (21:06 -0600)]
Implement variable length lookbehind in regex patterns
See [perl #132367].
Karl Williamson [Sun, 17 Mar 2019 18:36:48 +0000 (12:36 -0600)]
regexec.c: regmatch(): Add pushing eol
This continues the process of changing regmatch() to be able to restrict
the end point of where it is looking in the input, by adding that eol
position to the pushed state, and popping it when appropriate.
Karl Williamson [Sun, 17 Mar 2019 16:52:41 +0000 (10:52 -0600)]
regexec.c: restrict match to substring in regmatch()
This begins to add the capability to regmatch() to not look beyond a
certain point in the string in order to find a match. But this is
currently set to the end of the entire string so it shouldn't affect any
current outcomes.
Karl Williamson [Sun, 17 Mar 2019 16:36:48 +0000 (10:36 -0600)]
regexec.c: Add parameter to static fcn
This parameter will be used to limit how far in the input string to
apply the function to. But currently, it is set to the end of the
string, so there should be no change from previous behavior.
Karl Williamson [Sat, 16 Mar 2019 19:37:59 +0000 (13:37 -0600)]
Add warning category for variable length lookbehind
Karl Williamson [Sun, 17 Mar 2019 16:19:21 +0000 (10:19 -0600)]
regexec.c: Rmv unnecessary assigns
We never use this variable again (this isn't in a loop unlike similar
cases in other functions in this file), so we don't care if it gets
updated. Instead use the source value directly.
Karl Williamson [Sun, 17 Mar 2019 18:00:23 +0000 (12:00 -0600)]
regexec.c: Delete unused macro
Karl Williamson [Sun, 17 Mar 2019 18:09:40 +0000 (12:09 -0600)]
regexec.c: Comment fixes, additions
Karl Williamson [Sun, 17 Mar 2019 18:07:41 +0000 (12:07 -0600)]
regexec.c: Move macro defns, comments adjacent to fcn
Over the years the heading comments for regmatch(), as well as the macro
definitions that are used by just it, have become separated from it by
many intervening functions. This moves things back so the things that
apply just to regmatch() are just before it.
Karl Williamson [Sat, 16 Mar 2019 20:26:49 +0000 (14:26 -0600)]
perlre: Link technique for variable length lookbehind
This web page gives a technique that one can use to achieve variable
length lookbehinds.
Dagfinn Ilmari Mannsåker [Mon, 18 Mar 2019 15:47:26 +0000 (15:47 +0000)]
perlvar: improve POD markup for $-[n] example
Closing and re-opening the C<> arond the I<> leads to weird formatting
in man/text mode. Instead nest the I<> inside the C<>.
David Mitchell [Tue, 12 Mar 2019 11:05:48 +0000 (11:05 +0000)]
fix paren buffer leak in (?|...)
The (?| ... | ... |... ) alternation resets the paren index for each
branch. This can trick the code in S_reg() into re-mallocing the open
and close paren index buffers during every branch, leaking the old ones.
This commit fixes the leak by introducing a new compilation variable,
RExC_parens_buf_size, which records the actual number of slots malloced.
By decoupling RExC_parens_buf_size from RExC_npar, it also means that
the code can allocate a buffer larger than currently needed. This means
that
/(.)(.)(.)(.)/
no longer does a malloc() and 3 reallocs(), but instead initially
mallocs 10 slots, and if more than 10 captures are seen during
compilation, reallocs() to 20, 40, 80 ....
Karl Williamson [Mon, 18 Mar 2019 04:11:04 +0000 (22:11 -0600)]
PATCH: [perl #131551] Too deep regex compilation recursion
This patch, started by Yves Orton, and refined in consultation with Tony
Cook, imposes a maximum depth of unclosed left parentheses, at which
point it croaks. This is to prevent the segfault in the ticket.
The patch adds a variable that can be set to increase or decrease this
limit at run time (actually regex compilation time) should this be
desired, and hence our pre-determined limit of 1000 can be changed if
necessary.
Karl Williamson [Mon, 18 Mar 2019 03:59:52 +0000 (21:59 -0600)]
regcomp.c: Use mnemonic for flag parameter
Karl Williamson [Sat, 16 Mar 2019 19:22:35 +0000 (13:22 -0600)]
perlre: Consistent casing and spelling of VERB args
Craig A. Berry [Sat, 16 Mar 2019 19:10:40 +0000 (14:10 -0500)]
realclean unidatafiles on VMS the same way as elsewhere.
We were deleting lib/unicore/*.pl, but with uni_keywords.pl there
is now one non-generated .pl file in that directory. Deleting it
in realclean caused subsequent configure attempts in the same
directory tree to fail.
Karl Williamson [Fri, 15 Mar 2019 17:11:11 +0000 (11:11 -0600)]
inline.h: Improve comment
Karl Williamson [Fri, 15 Mar 2019 03:39:56 +0000 (21:39 -0600)]
utf8_length() Add two UNLIKELY()s
The input is likely to be valid.
Karl Williamson [Thu, 23 Nov 2017 06:10:01 +0000 (23:10 -0700)]
S_multiconcat() Use faster variant counting
Karl Williamson [Thu, 23 Nov 2017 06:12:37 +0000 (23:12 -0700)]
toke.c: lex_stuff_pvn() Use faster UTF-8 variant count
What finally got me to push this commit, since speed really doesn't
matter during compilation, is that this removes a hand-rolled
implementation.
Karl Williamson [Thu, 14 Mar 2019 23:37:29 +0000 (17:37 -0600)]
t/re/pat.t: Add test for [perl #133933]
This was fixed by
bf848a12528ab1e63a2f20da532eda498adbdca6.
Karl Williamson [Thu, 14 Mar 2019 23:06:16 +0000 (17:06 -0600)]
regcomp.c: Add assertions
These make sure we don't exceed the 32 bits available for long jumps.
Karl Williamson [Thu, 14 Mar 2019 22:46:50 +0000 (16:46 -0600)]
Add more checking for regnode offset overflowing
This is part of the ongoing failures in [perl #133921].
The bottom line cause is that there are generally 16 bits available for
the address of the next regnode. On very large patterns, this may not
be enough. When that happens, a long jump is used instead.
What previous commits have done is to insert tests in a loop to detect
that overflow isn't going to occur. But it turns out that there are
other places where such overflow could occur. The real solution should
be to detect overflow in the base level routine that would otherwise get
things wrong. This entails making that routine be able to return
failure. It turns out that another function is used under DEBUGGING, so
that one must be changed as well. And the calls where it is possible
for this to overflow are changed to look for failure return and proceed
appropriately, which is to set a flag that we need to use long jumps,
and restart the parse.
Karl Williamson [Thu, 14 Mar 2019 17:50:10 +0000 (11:50 -0600)]
regnodes.h, perldebguts: Shorten some descriptions
Karl Williamson [Thu, 14 Mar 2019 17:48:11 +0000 (11:48 -0600)]
Any Common digit set can match in any script
This fixes a design flaw in script runs that in 5.30 effectively
prevented digits from the Common script except the ASCII [0-9] from
being in any meaningful script run.
Karl Williamson [Thu, 14 Mar 2019 03:25:05 +0000 (21:25 -0600)]
PATCH: [perl #133921] Segfaults in regcomp.c
If a regular expression pattern gets too long so that the branch
instructions need more bits than are available, it is supposed to
reparse and use long jumps instead of the normal ones that don't take up
extra room. The blamed commit caused the test for this to be done too
late. This just moves the test to do it in time; lexically later in the
file, but just after the variable takes on the too-large value and
before it gets used in the next loop iteration.
Karl Williamson [Thu, 14 Mar 2019 03:24:47 +0000 (21:24 -0600)]
t/re/pat.t: Rmv stray semi-colon
Karl Williamson [Thu, 14 Mar 2019 01:11:46 +0000 (19:11 -0600)]
PATCH: [perl #133871] heap-buffer-overflow in S_reginsert
The regex compiler was written assuming it knew how many parentheses
pairs there were at code generation time. When I converted to a single
pass in
7c932d07cab18751bfc7515b4320436273a459e2, most things were
straight forward to not have to know this number, but there were a few
where it was non-trivial (for me anyway) to figure out how to handle.
So I punted on these and do a second pass when these are encountered.
There are few of them and are less commonly used, namely (?R), (?|...)
and forward references to groups (which most commonly will end up being
a syntax error anyway).
The fix in this commit is to avoid doing some parentheses relocations
when a regnode is inserted when it is known that the parentheses counts
are unreliable (during initial parsing of one of these tricky
constructs). The code in the ticket is using a branch reset '(?|...)'.
A second pass will get done, and the insert properly handled then, after
the counts are reliable.
Karl Williamson [Thu, 14 Mar 2019 00:41:45 +0000 (18:41 -0600)]
regcomp.c: Create macro, add comments
Karl Williamson [Thu, 14 Mar 2019 00:45:34 +0000 (18:45 -0600)]
regcomp.c: Rmv unused variable
Karl Williamson [Tue, 12 Mar 2019 21:56:05 +0000 (15:56 -0600)]
t/re/pat.t: Outdent 2 lines
Karl Williamson [Thu, 14 Mar 2019 00:03:01 +0000 (18:03 -0600)]
Allow qr'\N{...}'
Karl Williamson [Wed, 13 Mar 2019 23:58:00 +0000 (17:58 -0600)]
regcomp.c: White-space, comments only
Karl Williamson [Thu, 12 Jan 2017 21:50:26 +0000 (14:50 -0700)]
toke.c: Allow \N{} handling fcn to be used elsewhere in core
This function will be used in regcomp.c in a later commit. This commit
changes the function so that it is callable outside of toke.c. It adds
a parameter and moves some code in new_constant to the wrapper function
so that these do not cause problems when called from outside toke. And
it adds some assertions
Karl Williamson [Thu, 12 Jan 2017 21:46:21 +0000 (14:46 -0700)]
toke.c: Add wrapper function
This is in preparation for the underlying function to be called from
elsewhere. This adds a wrapper to be used internally in toke.c that
keeps the other caller of the underlying function from having to know
the changes to that function. That function is changed to return any
error message instead of raising it itself.
Karl Williamson [Tue, 17 Jan 2017 00:43:06 +0000 (17:43 -0700)]
toke.c: Change API of static function
This will be useful in future commits. new_constant() is changed so
that if an extra parameter is not NULL, it sets it to point to an error
message instead of raising the message itself. Thus its caller can
choose to handle errors itself.
Tony Cook [Wed, 13 Mar 2019 23:19:04 +0000 (10:19 +1100)]
there is no sv_catpvfn()
Replace in various documentation and messages appropriately.
Karl Williamson [Fri, 8 Mar 2019 20:16:53 +0000 (13:16 -0700)]
regcomp.h: Rmv obsolete references to 'swash'
regexes no longer use these
Karl Williamson [Wed, 13 Mar 2019 21:21:39 +0000 (15:21 -0600)]
regexec.c: We know the end ptr; don't need to recalc
Karl Williamson [Wed, 13 Mar 2019 21:20:50 +0000 (15:20 -0600)]
regexec.c: Add assertion
Karl Williamson [Wed, 13 Mar 2019 20:23:03 +0000 (14:23 -0600)]
regcomp.c: Add assertion
Karl Williamson [Wed, 13 Mar 2019 19:36:00 +0000 (13:36 -0600)]
regcomp.c: Rmv unnecessary branch
The function memchr() seems to get inlined so it is very fast, and it's
legal to call it with a 0 length, so let it figure out that it's zero.
Karl Williamson [Wed, 13 Mar 2019 19:23:24 +0000 (13:23 -0600)]
perlvar: Fix broken link
Karl Williamson [Wed, 13 Mar 2019 19:18:28 +0000 (13:18 -0600)]
perlrecharclass: Minor wording improvements
Karl Williamson [Wed, 13 Mar 2019 19:17:39 +0000 (13:17 -0600)]
perlre: Minor wording improvements
Karl Williamson [Wed, 13 Mar 2019 19:16:43 +0000 (13:16 -0600)]
perlre: Italicize a bunch of stuff
These are not meant to be written literally.
Karl Williamson [Wed, 13 Mar 2019 17:42:15 +0000 (11:42 -0600)]
dquote.c: Use UTF8_SAFE_SKIP
Otherwise malformed input could cause this to return a pointer outside
its buffer
Karl Williamson [Wed, 13 Mar 2019 17:41:09 +0000 (11:41 -0600)]
Add UTF8_SAFE_SKIP API macro
This version of UTF8SKIP refuses to advance beyond the end pointer
Karl Williamson [Wed, 13 Mar 2019 16:38:13 +0000 (10:38 -0600)]
perldiag: A deprecation is now fatal
Karl Williamson [Tue, 12 Mar 2019 22:21:27 +0000 (16:21 -0600)]
t/re/pat_advanced.t: Change some ok's to like's
Dan Kogai [Wed, 13 Mar 2019 02:09:18 +0000 (22:09 -0400)]
Encode: synch with CPAN version 3.01
Karl Williamson [Tue, 12 Mar 2019 21:47:15 +0000 (15:47 -0600)]
toke.c: Clarify comment
Karl Williamson [Tue, 12 Mar 2019 21:20:29 +0000 (15:20 -0600)]
t/re/pat_advanced.t: Add some comments
Karl Williamson [Tue, 12 Mar 2019 17:36:48 +0000 (11:36 -0600)]
Add tests for wildcards in Unicode property values
Karl Williamson [Mon, 11 Mar 2019 23:16:34 +0000 (17:16 -0600)]
Add Unicode property wildcards
Karl Williamson [Mon, 11 Mar 2019 21:55:54 +0000 (15:55 -0600)]
regen/mk_invlists.pl: Add tables for Unicode wildcards
This supports this new feature.
Karl Williamson [Mon, 11 Mar 2019 19:14:36 +0000 (13:14 -0600)]
Add warnings category experimental::uniprop_wildcards
Karl Williamson [Thu, 7 Mar 2019 22:31:58 +0000 (15:31 -0700)]
is_invlist(): Allow NULL input
For generality, it should allow a NULL and return FALSE.
Karl Williamson [Mon, 11 Mar 2019 23:10:06 +0000 (17:10 -0600)]
perlunicode: Update, clarify
This updates to match the latest Unicode document on regular
expressions, and to incorporate changes that have happened to Perl that
didn't get updated here. It also includes new clarifications about some
of the Unicode requirements.
Karl Williamson [Thu, 7 Mar 2019 22:29:28 +0000 (15:29 -0700)]
perlapi: Clarify entry for hv_store()
Karl Williamson [Mon, 11 Mar 2019 17:18:18 +0000 (11:18 -0600)]
regen/mk_invlists.pl: Remove stray debugging stmts
These debugging lines were left in by
21c34e9717d
Karl Williamson [Sat, 9 Mar 2019 18:09:01 +0000 (11:09 -0700)]
regen/mk_invlists.pl: Comment/white-space only
Karl Williamson [Sat, 9 Mar 2019 16:43:45 +0000 (09:43 -0700)]
regen/mk_invlists.pl, lib/utf8_heavy.pl: Rename variable
This renames a variable to more accurately reflect its content, and adds
a new one which has the old name but with an accurate content.
Karl Williamson [Thu, 7 Mar 2019 22:14:56 +0000 (15:14 -0700)]
charclass_invlists.h: Add comment
Karl Williamson [Sat, 9 Mar 2019 18:48:20 +0000 (11:48 -0700)]
t/re/reg_mesg.t: Add test
David Mitchell [Tue, 12 Mar 2019 07:10:10 +0000 (07:10 +0000)]
fix blead on non-threaded builds
My recent v5.29.8-64-g02a9632ac4 commit broke unthreaded builds.
This is the obvious fix. I've heard a report that unthreaded perl
SEGVs now but can't reproduce.
David Mitchell [Mon, 11 Mar 2019 16:18:10 +0000 (16:18 +0000)]
Fix leak on syntax error in main prog
t/lib/croak.t was failing several tests under ASan because it was
running small stand-alone programs with some sort of error in, such as
BEGIN { }
myfunc 1;
Unlike other code paths (such as S_doeval_compile() for evals),
Perl_newPROG() - when called for the main body rather than for a
completed eval - was calling cv_forget_slab() on PL_compcv regardless of
whether an error was present. That call converts the compiling CV into
a compiled one, which disclaims ownership of the slab(s) its ops are
embedded in. This means that when the CV is freed, ops within the slab
which aren't embedded within the PL_main_root tree would leak.
Such ops may exist when Perl_newPROG() is reached after one of more
errors.
The fix is simply to not call cv_forget_slab() if the error count is > 0.
David Mitchell [Fri, 8 Mar 2019 08:40:29 +0000 (08:40 +0000)]
fix leak when compiling typed hash deref
In something like
my Foo $h;
$h->{bad_key}
perl will croak if package Foo defines valid %FIELDS and bad_key isn't
one of them. This croak happens during the second pass in
S_maybe_multideref(), which is trying to convert $h->{bad_key} into a
single multideref op. Since the aux buffer is allocated at the end of
the first pass, the buffer leaks.
The fix is to do the check in the first pass, which has been done by
adding an extra boolean flag to S_check_hash_fields_and_hekify(),
indicating whether to just check or actually do it.
Karl Williamson [Fri, 8 Mar 2019 16:45:37 +0000 (09:45 -0700)]
Don't use utf8_heavy.pl unless needed
Prior to this commit 'use utf8' loaded utf8_heavy.pl. But previous
commits in the 5.29 series mean it is not needed from the core unless a
tr/// is using UTF-8, a much less likely occurrence. So load it only on
demand
Karen Etheridge [Sun, 10 Mar 2019 20:33:58 +0000 (13:33 -0700)]
upgrade ExtUtils::Manifest from version 1.71 to 1.72