Files
Azat KhuzhinandClaude Opus 4.6 84a8db7a03 Fix heap-buffer-overflow in Rust CXX bridge due to std::exception ABI mismatch
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]>
2026-05-15 20:39:10 +02:00
..