summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2009-11-26 16:41:22 +0000
committerH.Merijn Brand <h.m.brand@xs4all.nl>2009-11-26 17:54:11 +0100
commit162177c1aed1991639f7f0da64e918c034e1148a (patch)
treeda7b79b9c915cf1a94856d711a477656c0ab4518 /pp_ctl.c
parent9735c8aa020a58992ffadba440014d200222da56 (diff)
downloadperl-162177c1aed1991639f7f0da64e918c034e1148a.tar.gz
-Dmad minitest failure bisect
I wrote: >In my tests with -Dmad, I'm still getting a test failure ("panic: input >overflow") from t/op/incfilter.t. The underlying problem is the filter >layer mishandling things when a filter function gives it a multiline >string, so it generates an invalid SV state (strlen(SvPVX(PL_linestr)) >> SvCUR(PL_linestr)). This faulty state also occurs without -Dmad, >and so doesn't appear to be Mad-related, it just doesn't in practice >cause the test panic without -Dmad. I'm investigating this bug now. It's fixed by the attached patch. Since the bug is an inconsistency in the SV data structure, it can't be sensibly tested from Perl code, so I'm at a loss for writing a test script. Hopefully that panic with -Dmad is sufficient. -zefram Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index cd099c8825..e69107e874 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4849,8 +4849,8 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
int status = 0;
SV *upstream;
STRLEN got_len;
- const char *got_p = NULL;
- const char *prune_from = NULL;
+ char *got_p = NULL;
+ char *prune_from = NULL;
bool read_from_cache = FALSE;
STRLEN umaxlen;
@@ -4953,8 +4953,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
prune_from = got_p + umaxlen;
}
} else {
- const char *const first_nl =
- (const char *)memchr(got_p, '\n', got_len);
+ char *const first_nl = (char *)memchr(got_p, '\n', got_len);
if (first_nl && first_nl + 1 < got_p + got_len) {
/* There's a second line here... */
prune_from = first_nl + 1;
@@ -4980,6 +4979,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
SvUTF8_on(cache);
}
SvCUR_set(upstream, got_len - cached_len);
+ *prune_from = 0;
/* Can't yet be EOF */
if (status == 0)
status = 1;