mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-13 09:53:15 +08:00
Harden vendored nim scanner against empty deserialize buffer
state_deserialize() dereferenced &buffer[0] and passed it to indent_vec_deserialize()'s nonnull argument even when buffer was NULL / buffer_len was 0 (the initial empty-state deserialize), tripping UBSan. Return early after clearing state when there is nothing to deserialize.
This commit is contained in:
+6
@@ -360,6 +360,12 @@ _nonnull_(1) static void state_deserialize(
|
||||
DBG("error: no buffer but buffer length > 0");
|
||||
return;
|
||||
}
|
||||
/* Empty/absent buffer: nothing to deserialize. Return early so we never
|
||||
* pass a null/zero-length pointer to indent_vec_deserialize's nonnull arg. */
|
||||
if (!buffer || buffer_len == 0) {
|
||||
state_clear(self);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned idx = 0;
|
||||
state_clear(self);
|
||||
|
||||
Reference in New Issue
Block a user