In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/553fa53cede7a0bcdb1e2c592f810642c77dfd19?hp=d9961b0ec89be9cdb4c32b2cf52e2cf8352453c1>
- Log ----------------------------------------------------------------- commit 553fa53cede7a0bcdb1e2c592f810642c77dfd19 Author: James E Keenan <[email protected]> Date: Wed Nov 9 20:56:15 2016 -0500 RT 130010: add regression test. M t/re/pat_advanced.t commit eee4c92039de41d6a277473b2d60e29584f67431 Author: Karl Williamson <[email protected]> Date: Wed Nov 9 21:55:41 2016 +0100 PATCH: [perl #130010] a5540cf breaks texinfo When a regular expression is compiled that contains user-defined properties, the subroutine the user must furnish to implement those properties may not yet be defined. To cope with this possibility, the regex pattern compiler stores the name and package of the subroutine, and this is to be expanded the first time the property is actually used during execution. Once expanded, the property should be immutable, and so the scalar containing the expansion is marked read-only. It turns out that prior to the blamed commit, that read-only-ness was being bypassed in some instances simply by freeing the scalar, replaced by a new one. The commit changed that. The pattern may contain components both known at compile time, and deferred until runtime. The two are combined at the time of expansion, but that was now running afoul of the read-only setting. This commit simply turns off the read-only flag at the time of expansion, and it's turned on again afterwards. The next commit will add a test. M utf8.c commit ee3222e312cbf5cc89df7b3cb3bd2ab5bb4e6507 Author: Karl Williamson <[email protected]> Date: Sat Nov 12 09:00:08 2016 +0100 utf8.c: Add comment M utf8.c ----------------------------------------------------------------------- Summary of changes: t/re/pat_advanced.t | 9 +++++++++ utf8.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index 5eb2cc5..08f4f53 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -2433,6 +2433,15 @@ EOF 'No segfault [perl #126886]'); } + { + # [perl 130010] Downstream application texinfo started to report panics + # as of commit a5540cf. + + runperl( prog => 'A::xx(); package A; sub InFullwidth{ return qq|\n| } sub xx { split /[^\s\p{InFullwidth}]/, q|x| }' ); + ok(! $?, "User-defined pattern did not cause panic [perl 130010]"); + } + + # !!! NOTE that tests that aren't at all likely to crash perl should go # a ways above, above these last ones. There's a comment there that, like # this comment, contains the word 'NOTE' diff --git a/utf8.c b/utf8.c index d757577..4dbefe5 100644 --- a/utf8.c +++ b/utf8.c @@ -3398,6 +3398,7 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m /* Add the passed-in inversion list, which invalidates the one * already stored in the swash */ invlist_in_swash_is_valid = FALSE; + SvREADONLY_off(swash_invlist); /* Turned on again below */ _invlist_union(invlist, swash_invlist, &swash_invlist); } else { @@ -3427,6 +3428,7 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m else SvREFCNT_inc_simple_void_NN(swash_invlist); } + /* The result is immutable. Forbid attempts to change it. */ SvREADONLY_on(swash_invlist); /* Use the inversion list stand-alone if small enough */ -- Perl5 Master Repository
