This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Karl Williamson [Sat, 13 Apr 2019 18:04:29 +0000 (12:04 -0600)]
t/loc_tools.pl: No setlocale when no locales
Don't call this function unconditionally. There may be no locale
handling available, so check that first.
Karl Williamson [Sat, 13 Apr 2019 18:01:40 +0000 (12:01 -0600)]
t/loc_tools.pl: miniperl can't use locale handling
Assume there is no locale handling on this system in the function
locales_enabled() if we are operating (as in minitest) without the boot
loader, as they can't be accessed because the POSIX module which
contains setlocale() can't be loaded.
Karl Williamson [Sat, 13 Apr 2019 18:01:02 +0000 (12:01 -0600)]
t/op/magic.t: Fix skip count
Karl Williamson [Fri, 12 Apr 2019 21:28:54 +0000 (15:28 -0600)]
Reinstate and fix failing POSIX mb.t test
Somehow I had pushed to blead a draft version of the test, rather than
the final one that actually should work. The draft is what got reverted
by
8cc54175018f1cabb5c0354371c9e2ee24f8ee5a. Reinstate the test,
corrected.
Karl Williamson [Fri, 12 Apr 2019 21:45:32 +0000 (15:45 -0600)]
PATCH: [perl #134004] BBC breaks Unicode::CharWidth
A user-defined property \p{IsFoo} is package specific, and can be
specified with :: package qualifiers \p{pkg1::pkg2::...::IsFoo}. Some
other package can also define an IsFoo which is totally independent of
the first. These properties are implemented by definining a sub IsFoo()
in the proper package. I used cv_name() to get the fully qualified name
of the sub. The problem with that is that it can evaluate to
pkg1::pkg2::...::_ANON_, for example. What I really want is the
property name IsFoo, fully qualified. This commit changes to do that.
Karl Williamson [Fri, 12 Apr 2019 21:37:34 +0000 (15:37 -0600)]
regcomp.c: Move code into a function
This is in preparation for it to be called from a 2nd place
Karl Williamson [Fri, 12 Apr 2019 20:33:58 +0000 (14:33 -0600)]
perlfunc: Clarify
Karl Williamson [Fri, 12 Apr 2019 19:15:27 +0000 (13:15 -0600)]
sv.c: Silence some warnings
This adds a cast to silence a warning. There could be loss of data, but
this is for the 'j' flag in printf which specifies the size the output
is to be in.
Karl Williamson [Fri, 12 Apr 2019 20:04:05 +0000 (14:04 -0600)]
Merge branch 'warnings' into blead
These several commits silence warnings specific to Microsoft compilers.
They are bogus warnings as far as we can determine, but persist through
many versions of the compilers.
commit
6879a07bc8b8e75c35d0e3b765ea718cc1c7aeb2
*Author: Tomasz Konojacki <me@xenu.pl>
Date: Thu Apr 4 22:39:38 2019 +0200
implement diagnostics ignore/restore macros for Visual C++
gave the easy infrastructure to turn off such warnings, but adding lines
to take advantage of this makes the code harder to read, and we came up
with alternative methods to shut the compiler up that are less
intrusive, involving casting, and subtracting from 0 instead of a unary
minus, that should be valid across platforms.
There were several other warnings I left in, because it would have
required more research than I have time for right now to be sure that
they are bogus.
Karl Williamson [Fri, 12 Apr 2019 19:09:59 +0000 (13:09 -0600)]
pp.c: Silence some MS VC warnings
These are bogus warnings.
Karl Williamson [Fri, 12 Apr 2019 19:14:21 +0000 (13:14 -0600)]
regcomp.c: Silence some MS VC warnings
These are bogus warnings.
Karl Williamson [Fri, 12 Apr 2019 19:13:41 +0000 (13:13 -0600)]
sv.c: Silence some MS VC warnings
These are bogus warnings.
Karl Williamson [Fri, 12 Apr 2019 19:11:45 +0000 (13:11 -0600)]
pp_hot.c: Silence some MS VC warnings
These are bogus warnings.
David Mitchell [Fri, 12 Apr 2019 15:18:57 +0000 (16:18 +0100)]
warnings.t: skip some leaky tests
A couple of tests in 7fatal leak, and thus fail, when run under Address
Sanitizer. I have a proper fix for this, but it's too close to 5.30 code
freeze to justify merging it yet. So just skip the problematic tests for
now.
David Mitchell [Fri, 12 Apr 2019 13:06:21 +0000 (14:06 +0100)]
fix leak in Perl_coresub_op()
This sub initially creates a new OP_COREARGS op to be made use of in the
various cases of a following switch statement. But in the specific case
of OP_SELECT, the op isn't actually used, and leaks. So don't allocate
it in this case.
The leak could be reproduced with the one-liner
defined &{"CORE::select"};
and was causing t/op/coresubs.t to fail under Address Sanitiser.
David Mitchell [Tue, 9 Apr 2019 09:33:34 +0000 (10:33 +0100)]
Avoid leak/crash calling CORE::foo()
The compile time code in Perl_ck_entersub_args_core() that converts a
subroutine call like mypos(1,2) into a direct call to the built-in
function, e.g. pos(1,2), doesn't handle too many args well.
The ops associated with the extra args are excised from the op tree,
but aren't freed, and their op_sigparent pointers aren't updated
correctly.
This is noticeable if op_free() is altered to walk the tree using
op_sigparent to walk back up to the parent.
This commit frees any extra args and emits the 'Too many arguments' error
immediately, rather than tripping over later.
David Mitchell [Fri, 12 Apr 2019 13:52:27 +0000 (14:52 +0100)]
fix leak in do { ... } while 0
The op tree for
do X while 0
is simplified to
X
but the const OP for the '0' wasn't being freed and so leaked.
David Mitchell [Thu, 11 Apr 2019 16:19:31 +0000 (17:19 +0100)]
Perl_newLISTOP() allocate OP_PUSHMARK safely
This commit is a prelude to allowing op_free() to make use the parent
pointer at the end of an op_sibling chain to walk a sub-tree to be freed.
newLISTOP() converts 0..2 ops into a list, adding a new parent list op
and possibly a pushmark op. However, under Safe.pm, and specifically in
dist/Safe/t/safeops.t, allocating a pushmark can croak. If the optree
under construct at this point isn't consistent (specifically the parent
pointer not yet set), then this can crash op_free() while trying to walk
the new list to free it.
The fix is to allocate the OP_PUSHMARK if needed *before* messing with
the structure of the list sub-tree.
James E Keenan [Fri, 12 Apr 2019 12:10:46 +0000 (12:10 +0000)]
Revert "ext/POSIX/t/mb.t: Add test for MB_CUR_MAX"
This reverts commit
858fc58a344c7550c68495d7fe648b39a1a50c0c.
The unit test introduced by the commit fails on many operating systems.
Signed-off-by: James E Keenan <jkeenan@cpan.org>
Tomasz Konojacki [Tue, 9 Apr 2019 21:15:41 +0000 (23:15 +0200)]
win32/Makefile: minor cleanup
Apart from the indentation fixes, the most notable change is
replacing constructs like this one:
!ELSE
!IF foo
!ENDIF
!ENDIF
with more readable:
!ELSEIF foo
!ENDIF
[perl #134014]
Karl Williamson [Tue, 9 Apr 2019 18:09:34 +0000 (12:09 -0600)]
mktables: Generalize handling of [perl #133979]
I realized that commit
f9c1e7e9ed13a16099c8471c2030b93deb482571
works now, but future Unicode versions may add fractions that fool it.
This commit should handle any such event
Karl Williamson [Sat, 6 Apr 2019 18:38:56 +0000 (12:38 -0600)]
PATCH: [perl #133992] Assertion failure in scan_const
I haven't done the digging, but this appears to be a failure to include
UTF-8 processing when 'use utf8' was added to Perl.
The code that was causing this in toke.c had found a qr/(?#... beginning
of comment in a pattern. It attempted to space up to but not including
the final character, which is handled later. (In most instances that
final character is a single-byte ')', but not in this test case. It
spaced per-byte. The problem is that if the final character is in UTF-8
and isn't a single byte, it leaves the input position pointing at the
final byte of that character, which creates malformed UTF-8, which the
assertion discovered.
The fix is to be cognizant that this is UTF-8 when spacing to the end,
so that the final position begins at the first byte of it.
Karl Williamson [Wed, 10 Apr 2019 18:54:30 +0000 (12:54 -0600)]
toke.c: Add assertion
Karl Williamson [Sat, 6 Apr 2019 20:08:49 +0000 (14:08 -0600)]
toke.c: White-space only
This outdents code that was removed from being in a block by the
previous commit.
Karl Williamson [Sat, 6 Apr 2019 20:05:29 +0000 (14:05 -0600)]
toke.c: Streamline a case
When we are parsing a constant, and the source and destination differ in
UTF-8ness, I realized, in single stepping through the code, that it's
simpler and more efficient to split these into two cases, rather than
try to do one case with some conditionals in the middle.
Karl Williamson [Sat, 6 Apr 2019 19:07:24 +0000 (13:07 -0600)]
toke.c: Change names of two variables
has_utf8 vs is_utf8. One means the source is utf8; the other that the
dest is utf8. But I could never remember which was which. Change so
that is obvious
Karl Williamson [Sat, 6 Apr 2019 18:29:07 +0000 (12:29 -0600)]
toke.c: Use local variable instead of global
These two lines used a PL_ variable, whereas every other use in this
function is a local copy of it. Change for consistency.
Karl Williamson [Wed, 10 Apr 2019 02:34:48 +0000 (20:34 -0600)]
t/re/pat.t: Silence 'wide char' warning
This was introduced in
0a5ed81e6617c9229cc1ea042e9a70c3ec63fd65
Karl Williamson [Wed, 10 Apr 2019 02:22:34 +0000 (20:22 -0600)]
PATCH: [perl #133999] Assertion failure in regex match
This was caused by failing to limit matching to within the bounds of the
target string. I'm pretty sure this bug has long been there, but was
exposed by the recently added wildcard property matching feature.
Karl Williamson [Wed, 10 Apr 2019 00:53:53 +0000 (18:53 -0600)]
PATCH: [perl #133995], Assertion failure in regmatch
This was due to my forgetting that when the positive operation can only
match UTF-8 invariant characters, the complement of it can match
variants. The only change needed is to pass the utf8ness to the macro
that does the work.
Karl Williamson [Sun, 7 Apr 2019 04:47:42 +0000 (22:47 -0600)]
regcomp.c: White space only
Indent the block newly formed in the previous commit.
Karl Williamson [Sun, 7 Apr 2019 04:42:05 +0000 (22:42 -0600)]
PATCH: [perl #133998] regcomp assertion failure
This was caused in the blamed commit by me thinking I could simplify too
much. So this commit puts back in checking specially for things like
/[\s\S]/l, which has to match every possible code point no matter what
the locale.
Steve Hay [Thu, 4 Apr 2019 17:08:52 +0000 (18:08 +0100)]
Add support for VS2019 (Visual C++ 14.2)
This also fixes LINK_FLAGS for VS2017 (Visual C++ 14.1): The subsystem
setting was missed in the changes to add VS2017 support, which was surely
just an oversight.
Karl Williamson [Wed, 3 Apr 2019 19:36:40 +0000 (13:36 -0600)]
ext/POSIX/t/mb.t: Add test for MB_CUR_MAX
Karl Williamson [Wed, 3 Apr 2019 19:17:56 +0000 (13:17 -0600)]
Make POSIX::mblen() slightly safer
by using a mutex around its call
Karl Williamson [Wed, 3 Apr 2019 18:20:08 +0000 (12:20 -0600)]
ext/POSIX/t/mb.t: Use actual expected char len
Some platforms want the precise number of expected bytes passed to
mblen(), not just some maximum.
Karl Williamson [Wed, 3 Apr 2019 18:14:19 +0000 (12:14 -0600)]
ext/POSIX/t/mb.t: Generalize for EBCDIC
Unicode Consortium [Tue, 2 Apr 2019 16:03:14 +0000 (10:03 -0600)]
Preliminary Unicode 12.1
Brian Greenfield [Mon, 8 Apr 2019 13:42:30 +0000 (09:42 -0400)]
Spelling correction in documentation.
Karl Williamson [Sun, 7 Apr 2019 00:00:58 +0000 (18:00 -0600)]
mktables: White-space only
Indent block newly formed in previous commit
Karl Williamson [Sat, 6 Apr 2019 23:51:13 +0000 (17:51 -0600)]
PATCH: [perl #133979] uniprops02 failing on Windows
This turns out to be because Windows doesn't necessarily round to even
on floating point %e conversions. The solution is to add an extra entry
rounding up to odd when a fraction is precisely representable in binary.
So far, the only case where this occurs is 1/32.
Tomasz Konojacki [Thu, 4 Apr 2019 20:39:38 +0000 (22:39 +0200)]
implement diagnostics ignore/restore macros for Visual C++
Karl Williamson [Fri, 5 Apr 2019 22:34:21 +0000 (16:34 -0600)]
PATCH: [perl #133988], Assertion failure
This was due to not checking that a \N{} expanded to a single code point
in contexts where only that is legal. This never could have worked
properly, though the assertion failure is new.
The diagnostic needs to be reworded to accommodate this new case, but
its too late in the 5.29 cycle to do that, so I'm changing just the
description, and will reword in 5.31, [perl #133996]
Karl Williamson [Fri, 5 Apr 2019 22:21:51 +0000 (16:21 -0600)]
PATCH: [perl #133896] Assertion failure
This was due to UTF8_SAFE_SKIP(s, e) not allowing s to be as large as e,
and there are legitimate cases where it can be. This commit hardens the
macro so that it never reads above e-1, returning 0 if it otherwise
would be required to. The assertion is changed to 's <= e'.
Karl Williamson [Fri, 5 Apr 2019 22:26:36 +0000 (16:26 -0600)]
regcomp.c: Change name of variable
This better reflects its use.
Karl Williamson [Fri, 5 Apr 2019 22:25:29 +0000 (16:25 -0600)]
regcomp.c: Consolidate code
This uses gotos to handle an identical panic case, instead of
duplicating the code.
Karl Williamson [Fri, 5 Apr 2019 23:04:38 +0000 (17:04 -0600)]
porting/diag.t: Allow nested =item's
This enhances this test to allow perldiag to have the descriptions of
error messages to contain =item lists (previously only bullet item lists
were allowed).
Karen Etheridge [Fri, 5 Apr 2019 20:54:19 +0000 (13:54 -0700)]
fix typo
Steve Hay [Fri, 5 Apr 2019 20:04:52 +0000 (21:04 +0100)]
5.28.2 should arrive this month
Also: 5.29.9 was released.
Steve Hay [Fri, 5 Apr 2019 20:01:29 +0000 (21:01 +0100)]
Add epigraph for 5.28.2-RC1
Steve Hay [Fri, 5 Apr 2019 18:34:10 +0000 (19:34 +0100)]
5.28.2-RC1 today
David Mitchell [Fri, 5 Apr 2019 16:01:53 +0000 (17:01 +0100)]
fixup to 'change LABEL type from pval to opval'
Commit v5.29.9-68-g017192018b broke g++ builds. Spotted by Karl.
David Mitchell [Fri, 5 Apr 2019 11:49:50 +0000 (12:49 +0100)]
parser: change LABEL type from pval to opval
The items pushed onto the parser stack can be one of several types:
ival, opval, pval etc. The only remaining use of pval is when a "label:"
is encountered.
When an error occurs during parsing, ops on the parse stack get
automatically reaped these days as part of the OP slab mechanism;
but bare strings (pvals) still leak.
Convert this one remaining pval into an opval, making the toker return
an OP_CONST with an SV holding the label.
Since newSTATEOP() still expects a raw string for the label, the parser
just grabs the value returned by the toker and makes a copy of the
string from it, then immediately frees the OP_CONST and its associated
SV.
The leak was showing up in ext/XS-APItest/t/stmtasexpr.t, which expects
to parse a statement where labels are banned.
Karl Williamson [Thu, 4 Apr 2019 15:12:29 +0000 (09:12 -0600)]
Define $d_has_C_UTF8 in Windows config files
Otherwise it gets an uninitialized warning.
Karl Williamson [Thu, 4 Apr 2019 19:44:22 +0000 (13:44 -0600)]
Partial patch for [perl #133970] Roman::Unicode broken
Wrap a call out to Perl code with PUSH/POP stacks.
This gets this module working again, and maybe head off some other smoke
failures, but there are other things needed, including tests, that I'm
working on.
Steve Hay [Thu, 28 Mar 2019 22:51:09 +0000 (22:51 +0000)]
Karl Williamson [Thu, 4 Apr 2019 18:49:41 +0000 (12:49 -0600)]
mktables: Turn off DEBUG
This inadvertently was left on, slowing down the process a little
Karl Williamson [Thu, 4 Apr 2019 03:22:29 +0000 (21:22 -0600)]
Silence some compiler warnings
Most of these are from Win32.
David Mitchell [Thu, 4 Apr 2019 13:38:50 +0000 (14:38 +0100)]
fix leak in Perl_vload_module()
This function allocates a few ops, then calls Perl_utilize().
If the latter function croaks early on, those ops will be leaked,
because they won't yet have been linked into the optree.
In particular, newUNOP(OP_REQUIRE, ...) can die if passed a non-valid
module name.
This can be fixed by moving the start_subparse() call to the start of
Perl_vload_module(), before any op allocations. start_subparse() creates
a new PL_compcv, and so any ops allocated afterwards will come from that
CV's slab rather than being directly malloc()ed. On death, the CV will
be freed and its op slab will be scanned and any ops found there freed.
The leak was showing up in ext/XS-APItest/t/load-module.t under ASan.
Karl Williamson [Wed, 3 Apr 2019 18:06:47 +0000 (12:06 -0600)]
t/charset_tools.pl: Add comments
Karl Williamson [Wed, 3 Apr 2019 20:27:00 +0000 (14:27 -0600)]
newlocale() has a problem in openbsd
And therefore we can't use it, until fixed.
https://marc.info/?l=openbsd-bugs&m=
155364568608759&w=2
Karl Williamson [Wed, 3 Apr 2019 20:31:05 +0000 (14:31 -0600)]
numeric.c: Change formal parameter to be const
as embed.fnc says it should be
Karl Williamson [Wed, 3 Apr 2019 16:25:26 +0000 (10:25 -0600)]
PATCH: [perl #133978] BBC breaks Jcode
This turned out to be caused by taking another macro as a template
without understanding the subtleties. In this case, the variable
'previous_occurrence_end' should be updated only if 'COND' is true. (In
the template the COND was implicitly true)
David Mitchell [Wed, 3 Apr 2019 15:11:54 +0000 (16:11 +0100)]
Avoid leaks in Perl_custom_op_get_field()
In 5.14.0 a new API was introduced to register details for custom ops.
Normally the caller supplies a pointer to a static xop struct with
details for the op, which gets gets added via a hidden
newSViv(PTR2IV(xop))
to PL_custom_ops values.
However, Perl_custom_op_get_field() also supports the older interface,
where name and desc entries were registered in PL_custom_op_names and
PL_custom_op_descs.
If it doesn't find an entry in PL_custom_ops, but does in
PL_custom_op_names, it fakes up a new-API registration in PL_custom_ops.
In this case the xop struct, and the name and description attached to it,
were leaking.
This commit fixes the leak by attaching magic to such newSViv(PTR2IV(xop))
SVs which frees the struct and strings.
David Mitchell [Wed, 3 Apr 2019 13:14:13 +0000 (14:14 +0100)]
fix leak in Devel-PPPort
The leaky code is only used during test. It creates 3 ops, does various
operations related to linking OpSIBLINGs, then fails to free them.
David Mitchell [Wed, 3 Apr 2019 12:23:24 +0000 (13:23 +0100)]
Data::Dumper - avoid leak on croak
v5.21.3-742-g19be3be696 added a facility to Dumper.xs to croak if the
recursion level became too deep (1000 by default).
The trouble with this is that various parts of DD_dump() allocate
temporary SVs and buffers, which will leak if DD_dump() unceremoniously
just croaks().
This currently manifests as dist/Data-Dumper/t/recurse.t failing under
Address Sanitiser.
This commit makes the depth checking code just set a sticky 'too deep'
boolean flag, and
a) on entry, DD_dump() just returns immediately if the flag is set;
b) the flag is checked by the top-level called of DD_dump() and croaks
if set.
So the net effect is to defer croaking until the dump is complete,
and avoid any further recursion once the flag is set.
This is a bit of a quick fix. More long-term solutions would be to
convert DD_dump() to be iterative rather than recursive, and/or make
sure all temporary SVs and buffers are suitably anchored somewhere so
that they get cleaned up on croak.
David Mitchell [Wed, 3 Apr 2019 10:06:22 +0000 (11:06 +0100)]
Fix recent double free in S_parse_gv_stash_name()
RT #133977
My recent commit v5.29.9-29-g657ed7c1c1 moved all buffer freeing to
the end of the function, but missed removing one of the existing frees.
The problem was spotted by James E Keenan and diagnosed by Tony Cook; I just
added a test.
A simple reproducer is
my $def = defined *{"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'x"};
Unicode Consortium [Tue, 2 Apr 2019 15:27:08 +0000 (09:27 -0600)]
Corrections to Unicode 12.0
Somehow I missed updating some files with the result that a few official
12.0 final corrections did not make it into
906f46d96ca4ba2d1039d576954bc5a47868348c.
These are mostly tests and break property changes for a few characters
David Mitchell [Tue, 2 Apr 2019 09:05:37 +0000 (10:05 +0100)]
fix locale.c under -DPERL_GLOBAL_STRUCT_PRIVATE
Karl Williamson [Sun, 31 Mar 2019 19:50:09 +0000 (13:50 -0600)]
handy.h: Parenthesize formal parameters in macro defn
These should be parenthesized to prevent issues when called with an
expression.
Alberto Simões [Sun, 31 Mar 2019 09:49:54 +0000 (10:49 +0100)]
Update EU::CBuilder to 0.280231
Committer: additional email address for contributor
James E Keenan [Sat, 30 Mar 2019 20:26:07 +0000 (16:26 -0400)]
Ed J [Sat, 30 Mar 2019 19:51:53 +0000 (15:51 -0400)]
quotemeta the stuff intended literally in RE
For: RT 133966
Committer: Bump $VERSION in dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
Karl Williamson [Thu, 21 Mar 2019 22:09:41 +0000 (16:09 -0600)]
regcharclass.h: Change to use new inRANGE macro
This was done by changing regen/regcharclass.pl. This results in half
the conditionals being needed, and in some cases better error checking.
Karl Williamson [Fri, 29 Mar 2019 18:57:40 +0000 (12:57 -0600)]
regexec.c: Use first byte info in ANYOFH
Commit
765e6ecf32a570694dcff91c1c72f98306a9390e changed ANYOFH regnodes
to note if the first byte of all code points matched is the same. When
that is the case we can potentially speed up matching by only trying to
match at points in the input where that byte occurs. Since ANYOFH nodes
match only UTF-8 encoded strings, that first byte is going to be a UTF-8
start byte. If that is uncommon in the target string, this is a real
winner.
Karl Williamson [Sun, 24 Mar 2019 03:29:51 +0000 (21:29 -0600)]
Remove zero length valgrind files at end.
This resolves [perl #131135]
Karl Williamson [Thu, 28 Mar 2019 03:20:58 +0000 (21:20 -0600)]
regcomp.c: Use new inRANGE macro
Karl Williamson [Thu, 28 Mar 2019 03:19:04 +0000 (21:19 -0600)]
numeric.c: use new inRANGE macro
This commit halves the number of conditionals needed in this hot code.
Karl Williamson [Thu, 28 Mar 2019 03:12:53 +0000 (21:12 -0600)]
handy.h: Convert some macros to use inRANGE
the latter is faster, having only one conditional.
Karl Williamson [Thu, 28 Mar 2019 03:09:14 +0000 (21:09 -0600)]
handy.h: Comments, remove extraneous parens
David Mitchell [Tue, 26 Mar 2019 14:58:04 +0000 (14:58 +0000)]
fix leak in Perl__force_out_malformed_utf8_message()
This function temporarily sets PL_curcop->cop_warnings to pWARN_ALL in
order to enforce mandatory warnings about malformed utf8, but it
didn't restore cop_warnings, so the old value leaked.
Can be reproduced with, e.g.
no warnings 'utf8';
CORE::evalbytes qq{ use utf8; "\\N{abc\x{c0}}"};
which is already exercised in t/uni/parser.t.
Karl Williamson [Fri, 29 Mar 2019 00:22:11 +0000 (18:22 -0600)]
PATCH: [perl #133347] Tk broken
This was caused by utf8_to_uvchr() failing to set the returned ptr
in some circumstances, leading to reading uninitialized memory.
A test failure remains, and I'll wait for Slaven's feedback before
looking further into that. It is in t/photo.t
couldn't recognize image data at blib/lib/Tk/Image.pm line 21.
# Looks like your test exited with 255 just after 100
And it's trying at that point to look at 'Xcamel.gif'
Karl Williamson [Thu, 28 Mar 2019 03:28:32 +0000 (21:28 -0600)]
perldiag: Rmv obsolete message
This restriction no longer exists, and is for an experimental feature
Karl Williamson [Thu, 28 Mar 2019 18:26:43 +0000 (12:26 -0600)]
PATCH: [perl #133942] BBC: BKB/Lingua-JA-Moji
This ticket was originally fixed by a PR being issued on the
distribution, which was merged and a new version placed on CPAN.
But before Slaven had a chance to test it, commit
765e6ecf32a570694dcff91c1c72f98306a9390e came along, and happened to
break it again from a totally independent cause.
So we have two separate bugs on the same ticket, only one of which was
perl's fault. And this commit fixes that. The problematic commit was
still looking in the regnode FLAGS field in one function, whereas that
field has been repurposed for ANYOFH nodes, so should be ignored for
them.
Karl Williamson [Sun, 24 Mar 2019 03:28:21 +0000 (21:28 -0600)]
perlapi: Add weasel word to make stmt accurate
It is possible to have a single-threaded build use the thread-safe
locale setting operations. Add a word to indicate it's not 100% the
other way.
Karl Williamson [Wed, 27 Mar 2019 16:28:21 +0000 (10:28 -0600)]
PATCH: [perl #133959] Free BSD broken tests
Commit
70bd6bc82ba64c1d197d3ec823f43c4a454b2920 fixed a leak (likely due
to a bug in glibc) by not duplicating the C locale object. However,
that meant that there's only one copy running around. And freeing that
will cause havoc, as its supposed to be there until destruction. What
appears to be happening is that the current locale object is freed upon
thread destruction, and that could be this global one. But I don't
understand why it's only happening on Free BSD and only on this version.
But this commit fixes the problem there, and makes sense. Simply don't
free this global object upon thread destruction.
This commit also changes it so it doesn't get destroyed at destruction
time, leaving it to the final PERL_SYS_TERM to free. I'm not sure, but
I think this fixes any issues with embedded perls.
Hugo van der Sanden [Mon, 25 Mar 2019 11:27:12 +0000 (11:27 +0000)]
[perl #133892] coredump in Perl_re_intuit_start
Make sure we have a valid non-utf8 'other' check substring before we
try to use it.
Karl Williamson [Tue, 26 Mar 2019 17:51:13 +0000 (11:51 -0600)]
perl5299delta: Fixes from errata
This makes the changes to this perldelta as listed in
07fbfc1d8cc566004b43d10c5bec8682b01400e8
This will make it easier to combine into the final 5.30 perldelta.
Tom Wyant [Tue, 26 Mar 2019 17:49:16 +0000 (11:49 -0600)]
perl5299delta: Clarify variable-length lookbehind entry
David Mitchell [Tue, 26 Mar 2019 12:33:46 +0000 (12:33 +0000)]
fix CvFILE() leak in Perl_newMYSUB()
This is basically the same as my recent fix for Perl_newATTRSUB_x(),
v5.29.8-46-gb37d10f658.
When overwriting cv with the contents of PL_compcv, it was checking the
CvDYNFILE(cv) flag (to see if CvFILE(cv) needed freeing) *after*
overwriting cv's flags with PL_compcv's flag.
David Mitchell [Tue, 26 Mar 2019 11:04:07 +0000 (11:04 +0000)]
avoid leak with local $h{foo}, $a[n]
When SAVEt_DELETE / SAVEt_ADELETE deletes a hash/array entry on scope
exit, they also decrement the refcount of the hash/array, and for the
hash, also free the saved key.
However, if the call to hv_delete() or av_delete() dies (e.g. when
calling a tied DELETE method) then the hash/array and key will leak
because leave_scope() calls av/hv_delete(), *then* does the
SvREFCNT_dec() etc.
The fix is to push new FREEPV/FREESV actions just before calling
av/hv_delete().
David Mitchell [Tue, 26 Mar 2019 08:56:55 +0000 (08:56 +0000)]
fix leak in package name lookup
S_parse_gv_stash_name() mallocs a temporary buffer when scanning package
names longer than 64 bytes. Depending on how it exits the function, it
doesn't always free the buffer afterwards. Change the function so that
there are only two exit points (which free the buffer) and make other bits
of code goto those two points.
Can be reproduced with e.g.
&{"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'x"}
Similar code is already present in t/op/stash_parse_gv.t
David Mitchell [Mon, 25 Mar 2019 20:13:30 +0000 (20:13 +0000)]
fix a leak with indented heredocs
With something like
|print <<~EOF;
| some data
| EOF
it croaks (as it should) with "Indentation ... doesn't match delimiter",
but in that case it leaks the recently malloc()d 'indent' buffer.
The fix is simple. I've also fixed by code inspection where the code
does 'goto interminable', although I didn't try to reproduce the conditions
where the goto might occur.
David Mitchell [Mon, 25 Mar 2019 19:44:57 +0000 (19:44 +0000)]
reformat S_scan_heredoc()
The indentation was inconsistent and confusing.
Reindent, add blank lines where appropriate, and change this code
comment: "(Closing '}' here to balance" to '<<}', since vim is far too
clever for its own good these days in terms of using '%' to bounce
between brace pairs.
Should be no functional changes.
David Mitchell [Mon, 25 Mar 2019 19:14:43 +0000 (19:14 +0000)]
S_scan_heredoc(): add cosmetic braces
add braces round a single-statement 'if' clause which contains a while
loop and spans several lines.
Should be functionally equivalent, but less visually confusing.
David Mitchell [Mon, 25 Mar 2019 17:18:58 +0000 (17:18 +0000)]
fix leak with local ${^WARNING_BITS} = ...
When restoring the old value, need to free the current value first.
Can be reproduced with
{
local ${^WARNING_BITS} = 'swit';
}
when run under ASan or similar.
An equivalent test already exists in t/op/leaky-magic.t.
Karl Williamson [Sun, 24 Mar 2019 20:36:50 +0000 (14:36 -0600)]
It's an error if any component of \p{user-defined} fails
A user-defined property can expand to more than one component that are
combined into a single result. Prior to this commit, since the move of
this into core C, it was possible that if any component was valid, the
whole thing was considered valid, though in many instances an assertion
failed on DEBUGGING builds.
Karl Williamson [Sun, 24 Mar 2019 20:27:38 +0000 (14:27 -0600)]
regcomp.c: Fix comment
It wasn't quite accurate
David Mitchell [Fri, 22 Mar 2019 17:38:48 +0000 (17:38 +0000)]
avoid leak assigning regexp to non-COW string
In something like
$s = substr(.....); # $s now a non-COW SvPOK() SV
$r = qr/..../;
$s = $$r;
$s's previous string buffer would leak when an SVt_REGEXP type SV is
assigned to it.
Worse, if $s was an SVt_PVPV, it would fail an assert on debugging
builds.
The fix is to make sure any remaining stringy stuff is cleaned up
before copying the REGEXP.
David Mitchell [Fri, 22 Mar 2019 15:43:56 +0000 (15:43 +0000)]
fix leak in BEGIN { threads->new(...) }
Normally by the time we reach perl_destruct(), PL_parser should be null
due to having its original (null) value restored by SAVEt_PARSER during
leaving scope (usually before run-time starts in fact). But if a thread
is created within a BEGIN block, the parser is duped, but the
SAVEt_PARSER savestack entry isn't. So PL_parser never gets cleaned up.
Clean it up in perl_destruct() instead. This is a bit of a hack.