arg = *fpc++;
f += arg;
fieldsize = arg;
+ {
+ STRLEN cur = t - SvPVX_const(PL_formtarget);
+ /* ensure there's always space for the ops which don't
+ * 'goto append' to unconditionally append a field's
+ * worth, e.g. FF_SPACE, FF_DECIMAL */
+ t = SvGROW(PL_formtarget, cur + fieldsize + 1) + cur;
+ }
if (MARK < SP)
sv = *++MARK;
case FF_NEWLINE: /* delete trailing spaces, then append \n */
f++;
while (t-- > (SvPVX(PL_formtarget) + linemark) && *t == ' ') ;
+ {
+ STRLEN cur = t - SvPVX_const(PL_formtarget);
+ t = SvGROW(PL_formtarget, cur + 1 + 1) + cur;
+ }
t++;
*t++ = '\n';
break;
my $bas_tests = 21;
# number of tests in section 3
-my $bug_tests = 66 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 6 + 2 + 3 + 96 + 11 + 14;
+my $bug_tests = 66 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 6 + 2 + 3 + 96 + 11 + 15;
# number of tests in section 4
my $hmb_tests = 37;
is $^A, $expected, "RT #130703";
}
+ # further buffer overflows with RT #130703
+
+ {
+ local $^A = '';
+ my $n = 200;
+ my $long = 'x' x 300;
+ my $numf = ('@###' x $n);
+ my $expected = $long . "\n" . (" 1" x $n);
+ formline("@*\n$numf", $long, ('1') x $n);
+
+ is $^A, $expected, "RT #130703 part 2";
+ }
+
# make sure it can cope with formats > 64k