mirror of
https://github.com/NixOS/nix
synced 2025-07-03 18:41:47 +02:00
flake: Enable UBSAN for checks
Doing this makes catching non-obvious bugs easier. GHA CI workload is
already a concern and there isn't much benefit in running the tests with
and without sanitizers at the same time, so UBSAN is enabled for default
checks.
This change doesn't affect production builds in any way, but is rather a
step in the direction of improving automated testing during development.
Relates to #10969.
(cherry picked from commit 874587516c
)
This commit is contained in:
parent
86271c364d
commit
b50c557e74
2 changed files with 36 additions and 6 deletions
|
@ -17,8 +17,10 @@ struct view_stringbuf : public std::stringbuf
|
|||
}
|
||||
};
|
||||
|
||||
std::string_view toView(const std::ostringstream & os)
|
||||
__attribute__((no_sanitize("undefined"))) std::string_view toView(const std::ostringstream & os)
|
||||
{
|
||||
/* Downcasting like this is very much undefined behavior, so we disable
|
||||
UBSAN for this function. */
|
||||
auto buf = static_cast<view_stringbuf *>(os.rdbuf());
|
||||
return buf->toView();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue