mirror of
https://github.com/NixOS/nix
synced 2025-07-05 12:21:48 +02:00
Merge pull request #12615 from xokdvium/ubsan-checks
flake: Enable UBSAN for checks
This commit is contained in:
commit
8e8edb5bf8
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