From 5d7e44a3cd3ff8ce26d8cb3e8790e302623b9746 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 8 Dec 2023 14:20:56 +0100 Subject: [PATCH] parser: address Code Analysis warning Nice catch: when calling with basic_bol::match(nullptr, 5, 5), the method addresses null[4]. Turned this condition into debug assert, as (nullptr, 5, 5) is invalid input parameter combination. --- include/stdex/parser.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/stdex/parser.hpp b/include/stdex/parser.hpp index 4b65944f5..3f1a2ec8c 100644 --- a/include/stdex/parser.hpp +++ b/include/stdex/parser.hpp @@ -625,6 +625,7 @@ namespace stdex _In_ size_t end = SIZE_MAX, _In_ int flags = match_default) { + _Assume_(text || !end); _Assume_(text || start >= end); bool r = start == 0 || (start <= end && stdex::islbreak(text[start - 1])); if ((r && !m_invert) || (!r && m_invert)) {