ref: 3edc71b4a92e93c30418df6da7447ac120ba4757
parent: 6d46176da4835180f7dc317df5179de9ce8d9dc0
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Jan 2 00:37:35 EST 2025
symbol_t: fix the fields ordering vs gensym_t This has caused issues with bounded comparison, detected by memory sanitizer as unitialized memory access. Add a note so it's less tempting to repeat the same mistake.
--- a/flisp.h
+++ b/flisp.h
@@ -57,11 +57,13 @@
value_t cdr;
}cons_t;
+// NOTE: symbol_t MUST have the same fields as gensym_t first
+// there are places where gensyms are treated as normal symbols
typedef struct {
- const char *name;
- value_t binding; // global value binding
fltype_t *type;
+ value_t binding; // global value binding
uint32_t hash;
+ const char *name;
uint8_t numtype;
uint8_t size;
uint8_t flags;