commit c16f08f22adef7dad04e696613af9bd2b1672869
parent c145c862f92b375bc4c603b3481e2c1422608703
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Sun, 7 May 2023 12:39:57 -0400
add error bounds checking when deleting objs.
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/mumble b/mumble
Binary files differ.
diff --git a/src/mumble.c b/src/mumble.c
@@ -49,6 +49,7 @@ enum {
LISPVAL_SEXPR,
LISPVAL_QEXPR,
};
+int LARGEST_LISPVAL = LISPVAL_QEXPR; // for checking out of bounds.
typedef struct lispval {
int type;
@@ -167,7 +168,7 @@ lispval* lispval_qexpr(void)
void print_lispval_tree(lispval* v, int indent_level);
void delete_lispval(lispval* v)
{
- if (v == NULL)
+ if (v == NULL || v->type > LARGEST_LISPVAL)
return;
// print_lispval_tree(v, 0);
if (VERBOSE)