Stop SVt_REGEXPs from being upgraded.
authorFather Chrysostomos <sprout@cpan.org>
Sat, 22 Jun 2013 07:51:14 +0000 (00:51 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 23 Jun 2013 06:16:41 +0000 (23:16 -0700)
commitecff11eb0f000fc186c1b5652087c979947e4389
treef06f7bcd08f2df9b2485692b603a1c0e3739716e
parent5a3c73497c32449b69801228df80f2b7aafce13b
Stop SVt_REGEXPs from being upgraded.

Any code that is going to write over a REGEXP will call
sv_force_normal first, which converts it to

This code started crashing in 5.12:

$_ = qr//;
@INC = sub { $_ };
require foo;

Search pattern not terminated at /loader/0x7fe3b082c2e8/foo.pm line 1.
Compilation failed in require at - line 4.
Segmentation fault: 11

With current bleadperl:

foo.pm did not return a true value at - line 4.
Segmentation fault: 11

This change makes it like this instead:

Can't upgrade REGEXP (8) to 15 at - line 3.

which is certainly an improvement.  We shouldn’t be getting any error
at all (OK, just a syntax error because (?^:) is not a valid expres-
sion), and the next commit will fix that, but this commit at least
turns a crash into a panic, in case future changes accidentally send a
regexp through sv_upgrade(sv, SVt_PVIO).
sv.c