shithub: femtolisp

Download patch

ref: 15306c74c7f0101c4c367a220f83911a25ff3e2e
parent: 4e18c3987bb3f2940be37db6ccb3d7986902e3a1
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Thu Nov 21 18:35:38 EST 2024

isbuiltin: check the tag first, then uintval

--- a/flisp.c
+++ b/flisp.c
@@ -29,8 +29,8 @@
 int
 isbuiltin(value_t x)
 {
-	uint32_t i = uintval(x);
-	return tag(x) == TAG_FUNCTION && i < nelem(builtins) && builtins[i].name != nil;
+	uint32_t i;
+	return tag(x) == TAG_FUNCTION && (i = uintval(x)) < nelem(builtins) && builtins[i].name != nil;
 }
 
 static value_t apply_cl(uint32_t nargs);