diff --git a/src/pcre2_match_next.c b/src/pcre2_match_next.c index ae5a12ab5..9feb82252 100644 --- a/src/pcre2_match_next.c +++ b/src/pcre2_match_next.c @@ -95,6 +95,12 @@ do_bumpalong(pcre2_match_data *match_data, PCRE2_SIZE offset) PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION pcre2_next_match(pcre2_match_data *match_data, PCRE2_SIZE *pstart_offset, uint32_t *poptions) { + /* Preconditions on argument values */ + + PCRE2_ASSERT(match_data != NULL); + PCRE2_ASSERT(pstart_offset != NULL); + PCRE2_ASSERT(poptions != NULL); + PCRE2_SIZE start_offset = match_data->start_offset; PCRE2_SIZE *ovector = match_data->ovector; @@ -105,6 +111,10 @@ pcre2_next_match(pcre2_match_data *match_data, PCRE2_SIZE *pstart_offset, uint32 if (match_data->rc < 0) return FALSE; + /* Preconditions on argument state */ + + PCRE2_ASSERT(match_data->code != NULL); + /* Match succeeded: get the start offset for the next match */ /* Although \K can affect the position of ovector[0], there are no ways to do