diff --git a/src/util/pm_char.c b/src/util/pm_char.c index dce19abd1b..a51dc11645 100644 --- a/src/util/pm_char.c +++ b/src/util/pm_char.c @@ -185,7 +185,7 @@ pm_strspn_number_kind_underscores(const uint8_t *string, ptrdiff_t length, const size++; } - if (string[size - 1] == '_') *invalid = string + size - 1; + if (size > 0 && string[size - 1] == '_') *invalid = string + size - 1; return size; }