[libcxx-commits] [libcxx] [libc++][hardening] Categorize more assertions. (PR #75918)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 22 12:11:23 PST 2023
================
@@ -4587,28 +4587,36 @@ public:
// element access:
_LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready");
+ // If the match results are not ready, this will return `0`.
+ _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::length() called when not ready");
return (*this)[__sub].length();
----------------
mordante wrote:
Suggestion for a followup: add a range validation on `__sub`.
https://github.com/llvm/llvm-project/pull/75918
More information about the libcxx-commits
mailing list