Skip to content

Commit 0498098

Browse files
author
Zefram
committed
narrow scope of argsv in sv_vcatpvfn_flags()
argsv was being retained between format specifiers, causing incorrect treatment of format specifiers following one that took an SV argument. Fixes [perl #132645].
1 parent b98da25 commit 0498098

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -11814,7 +11814,6 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
1181411814
STRLEN origlen;
1181511815
Size_t svix = 0;
1181611816
static const char nullstr[] = "(null)";
11817-
SV *argsv = NULL;
1181811817
bool has_utf8 = DO_UTF8(sv); /* has the result utf8? */
1181911818
const bool pat_utf8 = has_utf8; /* the pattern is in utf8? */
1182011819
/* Times 4: a decimal digit takes more than 3 binary digits.
@@ -11919,6 +11918,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
1191911918
Size_t efix = 0; /* explicit format parameter index */
1192011919
const Size_t osvix = svix; /* original index in case of bad fmt */
1192111920

11921+
SV *argsv = NULL;
1192211922
bool is_utf8 = FALSE; /* is this item utf8? */
1192311923
bool arg_missing = FALSE; /* give "Missing argument" warning */
1192411924
char esignbuf[4]; /* holds sign prefix, e.g. "-0x" */

t/lib/warnings/op

+7
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ Scalar value @a[...] better written as $a[...] at - line 13.
189189
Scalar value @a{...} better written as $a{...} at - line 14.
190190
########
191191
# op.c
192+
# [perl #132645]
193+
use warnings 'syntax';
194+
@inf[3];
195+
EXPECT
196+
Scalar value @inf[3] better written as $inf[3] at - line 4.
197+
########
198+
# op.c
192199
use utf8;
193200
use open qw( :utf8 :std );
194201
use warnings 'syntax' ;

0 commit comments

Comments
 (0)