diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c index 83c9d159ca7..e768a042628 100644 --- a/source/blender/blenlib/intern/string_cursor_utf8.c +++ b/source/blender/blenlib/intern/string_cursor_utf8.c @@ -111,6 +111,8 @@ static eStrCursorDelimType cursor_delim_type_utf8(const char *ch_utf8, bool BLI_str_cursor_step_next_utf8(const char *str, const int str_maxlen, int *pos) { /* NOTE: Keep in sync with #BLI_str_cursor_step_next_utf32. */ + BLI_assert(str_maxlen >= 0); + BLI_assert(*pos >= 0); if (*pos >= str_maxlen) { return false; @@ -133,6 +135,8 @@ bool BLI_str_cursor_step_next_utf8(const char *str, const int str_maxlen, int *p bool BLI_str_cursor_step_prev_utf8(const char *str, const int str_maxlen, int *pos) { /* NOTE: Keep in sync with #BLI_str_cursor_step_prev_utf32. */ + BLI_assert(str_maxlen >= 0); + BLI_assert(*pos >= 0); if ((*pos > 0) && (*pos <= str_maxlen)) { const char *str_pos = str + *pos; @@ -230,6 +234,7 @@ bool BLI_str_cursor_step_next_utf32(const char32_t *str, const int str_maxlen, i { /* NOTE: Keep in sync with #BLI_str_cursor_step_next_utf8. */ BLI_assert(str_maxlen >= 0); + BLI_assert(*pos >= 0); if (*pos >= str_maxlen) { return false; @@ -245,6 +250,7 @@ bool BLI_str_cursor_step_prev_utf32(const char32_t *str, const int str_maxlen, i { /* NOTE: Keep in sync with #BLI_str_cursor_step_prev_utf8. */ BLI_assert(str_maxlen >= 0); + BLI_assert(*pos >= 0); UNUSED_VARS_NDEBUG(str_maxlen); if (*pos <= 0) {