-
Notifications
You must be signed in to change notification settings - Fork 279
Sorted array operations do not validate sortedness #2832
Copy link
Copy link
Labels
corelibRelated to Miden VM core libraryRelated to Miden VM core librarydocumentationImprovements or additions to documentationImprovements or additions to documentation
Milestone
Description
In the standard library, procedures like std::array::binary_search and related sorted-array helpers assume the input is sorted but do not validate this precondition. If passed an unsorted array:
- Binary search may return incorrect results or infinite loop
- Insertion may produce a still-unsorted array
The documentation states the input must be sorted, so this is expected behavior. However, users may be surprised that invalid input produces silent corruption rather than an error.
Recommendation: either document this more prominently, or add a debug-mode assertion that checks sortedness on entry.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
corelibRelated to Miden VM core libraryRelated to Miden VM core librarydocumentationImprovements or additions to documentationImprovements or additions to documentation