Example code to trigger SAN and UBSAN reports
This package provides example for the Address Sanitize and Undefined Behaviour Sanitize features provided by recent gcc and clang versions.
Recent gcc and clang compiler versions provide functionality to memory violations and other undefined behaviour; this is often referred to as “Address Sanitizer” (or SAN) and “Undefined Behaviour Sanitizer” (UBSAN). The Writing R Extension manual describes this in some detail in Section 4 (titled “Debugging”).
This feature has to be enabled in the corresponding binary, eg in R, which is somewhat involved as it also required a current compiler toolchain which is not yet widely available, or in the case of Windows, not available at all (via the common Rtools mechanism).
This R package then provides a means of testing the compiler setup as the known code failures provides in the sample code here should be detected correctly, whereas a default build of R will let the package pass.
The code samples are based on the examples from the Address Sanitizer Wiki.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.