summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-08-24 06:38:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-08-24 06:38:32 -0700
commitb0a700fe2af15b69fdf69f349668baf9189e90aa (patch)
tree50e412390e036c056c5bd2381d2e43518511b79a
parent73dd0fcbcbe2e9a34720af5eb24cd0f85206fff7 (diff)
downloadtxr-b0a700fe2af15b69fdf69f349668baf9189e90aa.tar.gz
txr-b0a700fe2af15b69fdf69f349668baf9189e90aa.tar.bz2
txr-b0a700fe2af15b69fdf69f349668baf9189e90aa.zip
trie filtering: ensure we don't misuse string_extend.
* filter.c (trie_filter_string): If a trie node is associated with a filter substitute object that isn't a character or string, then convert that to a string using tostringp. It could be an integer. If so and we feed that to string_extend, it will extend the string.
-rw-r--r--filter.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/filter.c b/filter.c
index 11637a29..37a27bcb 100644
--- a/filter.c
+++ b/filter.c
@@ -280,6 +280,8 @@ static val trie_filter_string(val filter, val str)
}
if (match) {
+ if (!stringp(subst) && chrp(subst))
+ subst = tostringp(subst);
string_extend(out, subst);
i = plus(match, one);
} else {