projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dcf8909
)
regcomp.c: truncate long debug dump output
author
Karl Williamson
<public@khwilliamson.com>
Thu, 5 Jan 2012 20:27:35 +0000
(13:27 -0700)
committer
Karl Williamson
<public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:38 +0000
(09:58 -0700)
What an ANYOF node matches could theoretically be millions of characters
long; This only outputs the first portion of very long ones.
regcomp.c
patch
|
blob
|
history
diff --git
a/regcomp.c
b/regcomp.c
index
0c30210
..
2d6bb7f
100644
(file)
--- a/
regcomp.c
+++ b/
regcomp.c
@@
-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);