add error bounds checking when deleting objs.

This commit is contained in:
NunoSempere 2023-05-07 12:39:57 -04:00
parent c145c862f9
commit c16f08f22a
2 changed files with 2 additions and 1 deletions

BIN
mumble

Binary file not shown.

View File

@ -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)