mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
ClickHouse patches `std::exception` with an embedded stack trace (`STD_EXCEPTION_HAS_STACK_TRACE`), adding `void* frames[32]` and `int size` — about 260 extra bytes. This define is propagated to normal C++ targets via `target_compile_definitions(cxx PUBLIC ...)`, but was missing from `RUST_CXXFLAGS` used to compile Rust CXX bridge code. When `skim` returned an error, the CXX bridge threw `rust::Error` (inheriting `std::exception`). The `throw` allocated exception storage based on the small unpatched `sizeof(Error)` (~24 bytes), but the actual `std::exception` constructor wrote to the patched layout with 260+ extra bytes for stack trace capture, causing a heap buffer overflow detected by ASan. The fix adds `-DSTD_EXCEPTION_HAS_STACK_TRACE=1` to `RUST_CXXFLAGS` so the bridge code sees the same `std::exception` layout as the rest of ClickHouse. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>