Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1064 +/- ##
========================================
Coverage 66.46% 66.46%
========================================
Files 773 773
Lines 55808 55808
Branches 8948 8948
========================================
+ Hits 37092 37093 +1
Misses 17059 17059
+ Partials 1657 1656 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The ASan compile flags were appended before add_subdirectory(third_party), where CMAKE_CXX_FLAGS is reset, and were only re-applied for the Python binding build. C++-only ASan jobs therefore linked the sanitizer runtime without compiling any instrumentation: leaks were still visible through malloc/free interposition, but heap-buffer-overflow, use-after-free and all UBSan checks were inactive for TsFile code. - Keep the sanitizer compile flags in TSFILE_SANITIZER_COMPILE_FLAGS and re-apply them after third_party for every ENABLE_ASAN build; third-party code stays uninstrumented. - Link the sanitizer runtime dynamically into libtsfile, the executables and the tools. A macOS dylib cannot carry unresolved __asan_* symbols, and two private runtimes in one process are unsupported, so the static-runtime branch is removed along with TSFILE_SANITIZER_SHARED_RUNTIME. - Skip LTO in Release builds whenever ASan is enabled, matching the binding build. - Add an asan_negative_control CTest case that deliberately writes past a heap allocation. A CMake driver checks the captured output for the sanitizer report instead of relying on the exit status, because ASan aborts on some platforms and CTest turns a subprocess abort into a failure. A build that loses instrumentation fails the test. Fixes #1062.
ColinLeeo
force-pushed
the
fix/1062-cpp-asan-instrumentation
branch
from
November 3, 2026 06:08
abe0d0d to
6042764
Compare
Contributor
Author
|
The first CI run failed on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1062.
ENABLE_ASAN=ONbuilds linked the sanitizer runtime but did not compile TsFile sources with-fsanitize: the flags were appended toCMAKE_CXX_FLAGSbeforeadd_subdirectory(third_party)resets that variable, and only the Python binding mode re-applied them. Leaks and invalid frees were still visible through malloc/free interposition, but heap-buffer-overflow, use-after-free and all UBSan checks were inactive for TsFile code.Changes
TSFILE_SANITIZER_COMPILE_FLAGSand re-apply them afterthird_partyfor everyENABLE_ASANbuild. Bundled third-party code stays uninstrumented.libtsfile, the executables and the tools. A macOS dylib cannot carry unresolved__asan_*symbols, and two private runtimes in one process are unsupported, so the-static-libasanbranch and theTSFILE_SANITIZER_SHARED_RUNTIMEoption are removed (cpp/build.sh,cpp/pom.xml,cpp/CLAUDE.mdandpython/SANITIZER.mdupdated).cpp/test/asan_negative_control.ccas a CTest case whenENABLE_ASANis ON. It performs a deliberate heap-buffer-overflow. A CMake driver script (cpp/test/asan_negative_control.cmake) runs it and passes only when the captured output contains the sanitizer report; the exit status is ignored because ASan aborts on macOS and CTest turns a subprocess abort into a test failure.Testing
address,undefined):tsfile_cwrapper.cc.oandlibtsfilecarry__asan_report_*references and linklibclang_rt.asan_osx_dynamic.dylib; ASan runtime initialization currently hangs on the macOS 26 host used here, so runtime checks were done on Linux.libtsfile.sohas undefined__asan_report*symbols andNEEDED libasan.so.5.ctest -R asan_negative_control: passes withERROR: AddressSanitizer: heap-buffer-overflow, both with the default settings and withASAN_OPTIONS=abort_on_error=1(macOS-like abort). The same driver returns 1 with a clear message when pointed at a deliberately uninstrumented build of the control.CliRequirements.VersionIncludesConcreteBuildMetadata(commit=unknown), which is caused by the out-of-tree direct CMake build used for this validation (it does not run Maven's version injection); it passes in the Maven-built suite.The CI matrix (
unit-test-cpp.yml,unit-test-cpp-msvc.yml) exercises this through the existing-Denable.asan=ONentries; no workflow change is needed.