From e280c955f7c2da68154fa2cd722a4ef68c081349 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Tue, 6 Oct 2026 16:50:41 +0200 Subject: [PATCH] fix(host-cache): hash every part of the project.so stamp The stamp that decides whether a compiled project file can be reused was meant to cover the crafter-build version, the toolchain key, the module-source stamp and the compile command. Only the version went in. The four parts were joined by a format string with "\0" between the fields, and a format string is read as a C string: it ended at the first NUL, so std::format saw "{}" and dropped the other arguments without a diagnostic. A project.so is loaded into the crafter-build process and fills in Configuration objects by their layout. With the stamp blind to the declarations, one built against other module sources was loaded as current whenever the version string was unchanged, which is every working-tree build (`git describe --dirty` does not follow the tree's contents) and every local Flatpak build. Growing a class that project files construct then corrupts the heap: a project.so built while Shader was 56 bytes, loaded after it had become 104, aborted with "free(): invalid size" as soon as it declared a shader. CI builds were spared only because each carries its own version. The parts are now appended to a std::string with NUL separators, the way the other stamps in this file are built. Every existing project.so carries a stamp of the version alone, so each is recompiled once. Co-Authored-By: Claude Fable 5.1 --- implementations/Crafter.Build-Platform.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/implementations/Crafter.Build-Platform.cpp b/implementations/Crafter.Build-Platform.cpp index f8a7694..03cdba2 100644 --- a/implementations/Crafter.Build-Platform.cpp +++ b/implementations/Crafter.Build-Platform.cpp @@ -845,7 +845,18 @@ Configuration Crafter::LoadProject(const fs::path& projectFile, std::span