mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
string.c (utf8_strlen): add assertion utf8_len <= byte_len
This commit is contained in:
@@ -447,6 +447,7 @@ utf8_strlen(mrb_value str)
|
||||
}
|
||||
else {
|
||||
mrb_int utf8_len = mrb_utf8_strlen(RSTR_PTR(s), byte_len);
|
||||
mrb_assert(utf8_len <= byte_len);
|
||||
if (byte_len == utf8_len) RSTR_SET_SINGLE_BYTE_FLAG(s);
|
||||
return utf8_len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user