diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-01-05 13:27:35 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-01-13 09:58:38 -0700 |
commit | c574ffb9e3a8b39aaba9060ba73c3b134fc572d3 (patch) | |
tree | 3a3d45cc066a670fea217ce5d0134756809dabf4 /regcomp.c | |
parent | dcf8909ac1f19ef2c4b6354bfe982913360e9041 (diff) | |
download | perl-c574ffb9e3a8b39aaba9060ba73c3b134fc572d3.tar.gz |
regcomp.c: truncate long debug dump output
What an ANYOF node matches could theoretically be millions of characters
long; This only outputs the first portion of very long ones.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -11978,7 +11978,16 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) } while (*s) { - if (*s == '\n') + if (*s == '\n') { + + /* Truncate very long output */ + if (s - origs > 256) { + Perl_sv_catpvf(aTHX_ sv, + "%.*s...", + (int) (s - origs - 1), + t); + goto out_dump; + } *s = ' '; } else if (*s == '\t') { @@ -11992,6 +12001,8 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) sv_catpv(sv, t); } + out_dump: + Safefree(origs); } SvREFCNT_dec(lv); |