mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 18:29:36 +01:00
libutil: Add custom PeekSort implementation
Unlike std::sort and std::stable_sort, this implementation does not lead to out-of-bounds memory reads or other undefined behavior when the predicate is not strict weak ordering. This makes it possible to use this function in libexpr for builtins.sort, where an incorrectly implemented comparator in the user nix code currently can crash and burn the evaluator by invoking C++ UB.
This commit is contained in:
parent
e73fcd008a
commit
b2596a7615
4 changed files with 575 additions and 0 deletions
|
|
@ -65,6 +65,7 @@ sources = files(
|
|||
'position.cc',
|
||||
'processes.cc',
|
||||
'references.cc',
|
||||
'sort.cc',
|
||||
'spawn.cc',
|
||||
'strings.cc',
|
||||
'suggestions.cc',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue