diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-01-22 16:21:13 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-01-22 16:21:13 -0800 |
commit | cfebff4836306e326fc2a738513594466b1beffc (patch) | |
tree | d7ebeab206a6bd2c75b5b9fab33c787a7a337e60 | |
parent | 6349796bd545f8d5cbe9dc6f0b78ec0b72aed225 (diff) | |
download | txr-cfebff4836306e326fc2a738513594466b1beffc.tar.gz txr-cfebff4836306e326fc2a738513594466b1beffc.tar.bz2 txr-cfebff4836306e326fc2a738513594466b1beffc.zip |
bugfix: gc issue in parser interface.
* parser.c (lisp_parse_impl): Add a call to gc_hint,
to protect the parser object from garbage collection.
We allocate this object, and then use a raw pointer to
the parser, which leaves it exposed. This resulted in
a crash of the tests/010/json.tl test case (which runs
with the --gc-debug mode). The crash doesn't occur in
a regular build; it reproduced in build configured
with --no-gen-gc. Possibly, why it doesn't repro under
generational GC is that the hash table which associates
streams and parsers may be moving the objects into the
mature generation.
-rw-r--r-- | parser.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -782,6 +782,8 @@ static val lisp_parse_impl(val self, enum prime_parser prime, return error_return_val; } + gc_hint(parser); + return pi->syntax_tree; } |