diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-01-06 00:26:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-01-06 00:26:31 -0700 |
commit | a0ab563c96bb9b96bce3c5f24af71b821bacdfde (patch) | |
tree | 16007cc499fd45010ebd56be820fd934ba217cbd | |
parent | 85ad83cfc0b14f8e1da5b2f7a3bc1086a19514f1 (diff) | |
download | txr-a0ab563c96bb9b96bce3c5f24af71b821bacdfde.tar.gz txr-a0ab563c96bb9b96bce3c5f24af71b821bacdfde.tar.bz2 txr-a0ab563c96bb9b96bce3c5f24af71b821bacdfde.zip |
gc: bug in sub-str on lazy string argument.
This showed up as an intermittent segfault on OpenBSD
of the test case tests/006/freeform-5.txr, reproducible
quite often, around 30% to 60%. This was with gcc 4.2.1.
* lib.c (lazy_sub_str): We need a gc_hint here on the
prefix hend in pfxcopy. The garbage collector is
scavenging that object, not seeing that we planted
it into a malloced structure.
-rw-r--r-- | lib.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -5653,6 +5653,7 @@ static val lazy_sub_str(val lstr, val from, val to) lsub->ls.props = coerce(struct lazy_string_props *, chk_copy_obj(coerce(mem_t *, lstr->ls.props), sizeof *lstr->ls.props)); + gc_hint(pfxcopy); return lsub; } } |