From ecff11eb0f000fc186c1b5652087c979947e4389 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 22 Jun 2013 00:51:14 -0700 Subject: [PATCH] Stop SVt_REGEXPs from being upgraded. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sv.c b/sv.c index 52af1d2..db0fac5 100644 --- a/sv.c +++ b/sv.c @@ -921,7 +921,7 @@ static const struct body_details bodies_by_type[] = { { sizeof(regexp), sizeof(regexp), 0, - SVt_REGEXP, FALSE, NONV, HASARENA, + SVt_REGEXP, TRUE, NONV, HASARENA, FIT_ARENA(0, sizeof(regexp)) }, -- 2.7.4