the fp offset, which was quite a big larger than the input file,
which meant that the SvGROW tried to grow the file to about
2**64-2**20, which made safesysrealloc() to understandably
croak (in argv.t).
p4raw-id: //depot/perl@19390
Stat_t st;
if (!PerlLIO_fstat(PerlIO_fileno(fp), &st) && S_ISREG(st.st_mode)) {
Off_t offset = PerlIO_tell(fp);
- if (offset != (Off_t) -1) {
+ if (offset != (Off_t) -1 && st.st_size + append > offset) {
(void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 1));
}
}