use strict;
use warnings;
-require './test.pl';
+BEGIN { chdir 't'; require './test.pl'; }
-plan(tests => 7);
+plan(tests => 8);
{
no warnings 'deprecated';
{ stderr => 1 },
'no crash when charnames cannot load and %^H holds string reference'
);
+
+# not fresh_perl_is, as it seems to hide the error
+is runperl(
+ nolib => 1, # -Ilib may also hide the error
+ progs => [
+ '*{',
+ ' XS::APItest::gv_fetchmeth_type()',
+ '}'
+ ],
+ stderr => 1,
+ ),
+ "Undefined subroutine &XS::APItest::gv_fetchmeth_type called at -e line "
+ ."2.\n",
+ 'no buffer corruption with multiline *{...expr...}'
+;
S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
{
dVAR;
- char *bracket = NULL;
+ SSize_t bracket = -1;
char funny = *s++;
char *d = dest;
char * const e = d + destlen - 3; /* two-character token, ending NUL */
}
/* Handle the opening { of @{...}, &{...}, *{...}, %{...}, ${...} */
if (*s == '{') {
- bracket = s;
+ bracket = s - SvPVX(PL_linestr);
s++;
orig_copline = CopLINE(PL_curcop);
if (s < PL_bufend && isSPACE(*s)) {
/* Warn about ambiguous code after unary operators if {...} notation isn't
used. There's no difference in ambiguity; it's merely a heuristic
about when not to warn. */
- else if (ck_uni && !bracket)
+ else if (ck_uni && bracket == -1)
check_uni();
- if (bracket) {
+ if (bracket != -1) {
/* If we were processing {...} notation then... */
if (isIDFIRST_lazy_if(d,is_utf8)) {
/* if it starts as a valid identifier, assume that it is one.
else {
/* Didn't find the closing } at the point we expected, so restore
state such that the next thing to process is the opening { and */
- s = bracket; /* let the parser handle it */
+ s = SvPVX(PL_linestr) + bracket; /* let the parser handle it */
CopLINE_set(PL_curcop, orig_copline);
*dest = '\0';
}