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

align C ported memsearch code - need to handle array[length] properly #5037

Merged
merged 1 commit into from Feb 14, 2018

Conversation

@kares
Copy link
Member

@kares kares commented Feb 8, 2018

... otherwise code doing utf8 str scan might fail with array-out-of-index

resolves GH-5036

someone with C knowledge please review, seems to me that MRI handles the case without special care :
at rb_memsearch_qs_utf8_hash(byte[] xBytes, final int x) while x == xBytes.length

... otherwise code doing utf8 str scan might fail with array-out-of-index

resolves GH-2036
@kares kares added this to the JRuby 9.1.16.0 milestone Feb 8, 2018
}
else {
h = '\0'; // (C) ary end - due y+m at rb_memsearch_qs_utf8
}
if (h < 0xC0) {
return h + 256;

This comment has been minimized.

@headius

headius Feb 13, 2018
Member

This will always return 256 at string end...is that correct?

This comment has been minimized.

@kares

kares Feb 13, 2018
Author Member

yep - should return the very same as the (original) C code when reaching \0 boundary

@kares kares merged commit 23f53d3 into jruby-9.1 Feb 14, 2018
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/travis-ci/push The Travis CI build failed
Details
@kares kares deleted the fix-2036-9.1 branch Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.