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

invalid bytes in ascii string result in ArrayIndexOutOfBoundsException on #chars #1361

Closed
jrochkind opened this Issue Dec 26, 2013 · 6 comments

Comments

Projects
None yet
2 participants
@jrochkind
Copy link

jrochkind commented Dec 26, 2013

Simple reproduction:

bad_bytes_ascii = "M\xA1xico".force_encoding("ASCII")
puts bad_bytes_ascii.chars.to_a.length

On MRI, outputs 6.

On jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-462-11M4609 [darwin-x86_64],

it raises:

RubyString.java:7337:in `each_charCommon19': java.lang.ArrayIndexOutOfBoundsException: -95
    from RubyString.java:7317:in `chars19'
    from RubyString$INVOKER$i$0$0$chars19_DBG.gen:-1:in `call'
    from JavaMethod.java:458:in `call'
    from RubyClass.java:548:in `finvoke'
    from Helpers.java:491:in `invoke'
    from RubyBasicObject.java:387:in `callMethod'
    from RubyEnumerator.java:274:in `each'
    from RubyEnumerator$INVOKER$i$each_DBG.gen:-1:in `call'
    from RubyClass.java:527:in `finvoke'
    from Helpers.java:479:in `invoke'
    from RubyEnumerable.java:96:in `callEach'
    from RubyEnumerable.java:423:in `to_a19'
    from RubyEnumerable$INVOKER$s$to_a19_DBG.gen:-1:in `call'
    from CachingCallSite.java:306:in `cacheAndCall'
    from CachingCallSite.java:136:in `call'
    from CallNoArgNode.java:60:in `interpret'
    from CallNoArgNode.java:60:in `interpret'
    from FCallOneArgNode.java:36:in `interpret'
    from NewlineNode.java:105:in `interpret'
    from BlockNode.java:71:in `interpret'
    from RootNode.java:129:in `interpret'
    from ASTInterpreter.java:121:in `INTERPRET_ROOT'
    from Ruby.java:838:in `runInterpreter'
    from Ruby.java:846:in `runInterpreter'
    from Ruby.java:677:in `runNormally'
    from Ruby.java:522:in `runFromMain'
    from Main.java:395:in `doRunFromMain'
    from Main.java:290:in `internalRun'
    from Main.java:217:in `run'
    from Main.java:197:in `main'
@jrochkind

This comment has been minimized.

Copy link
Author

jrochkind commented Dec 26, 2013

(updated with version string and stack trace from jruby 1.7.9; I actually reproduced on jrubies 1.7.4-1.7.9)

@headius

This comment has been minimized.

Copy link
Member

headius commented Feb 21, 2014

Still failing as of 1.7.11.

@headius headius modified the milestones: JRuby 1.7.12, JRuby 1.7.11 Feb 21, 2014

@headius headius modified the milestones: JRuby 1.7.11, JRuby 1.7.12 Feb 21, 2014

@headius headius closed this in 9cb8243 Feb 21, 2014

@headius

This comment has been minimized.

Copy link
Member

headius commented Feb 21, 2014

Sorry this took so long for such a trivial fix.

@jrochkind

This comment has been minimized.

Copy link
Author

jrochkind commented Feb 26, 2014

thanks. Any easy way for me to figure out what subsequent release includes this fix?

@headius

This comment has been minimized.

Copy link
Member

headius commented Feb 26, 2014

This fix went into 1.7.11, released yesteday.

@jrochkind

This comment has been minimized.

Copy link
Author

jrochkind commented Feb 26, 2014

Awesome, thanks, I will update my docs that warn people of a bug in jruby
effecting my gems to say it's fixed in 1.7.11, thanks!

On Wed, Feb 26, 2014 at 9:40 AM, Charles Oliver Nutter <
notifications@github.com> wrote:

This fix went into 1.7.11, released yesteday.

Reply to this email directly or view it on GitHubhttps://github.com//issues/1361#issuecomment-36131181
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.