Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong number of characters in broken UTF-8 string #6255

Closed
dearblue opened this issue Apr 26, 2024 · 1 comment
Closed

Wrong number of characters in broken UTF-8 string #6255

dearblue opened this issue Apr 26, 2024 · 1 comment

Comments

@dearblue
Copy link
Contributor

mruby built with MRB_UTF8_STRING enabled does not count characters in the 0x80...0xc0 in broken strings.

Here is the result when built with build_config/host-debug.rb:

p "\x80\x81\x82\x83".size
# => 0 (acctual; currently master 7edbff8c83cd19749da576aca945fcbf64602bd5, mruby-3.3.0, mruby-3.2.0)
# => 4 (expected; mruby-3.1.0, CRuby)

I checked with git bisect and it reported commit 916fd64.
But now it has been replaced by the SWAR technique, so a simple revert is not possible.

I don't know how to fix it, so I'll just report it.

@matz
Copy link
Member

matz commented Apr 28, 2024

Ah, the new SWAR code assumes the string UTF-8 encoding is valid. Let me think for a while.
Thank you for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants