Skip to content

ArrayIndexOutOfBoundsException matching regex against emoji string #7830

@mohamedhafez

Description

@mohamedhafez

Trying to run the following code:

"😆🚌🚌🚌🥍🛤️🛤️♥️" =~ /confirmation/i

returns the following error, on both Mac and Linux JRuby 9.4.2.0:

org.jruby.dist/org.jcodings.specific.BaseUTF8Encoding.mbcCaseFold(BaseUTF8Encoding.java:154): Index -2 out of bounds for length 57 (Java::JavaLang::ArrayIndexOutOfBoundsException)

Environment Information

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)

jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913 OpenJDK 64-Bit Server VM 17.0.7+7-LTS on 17.0.7+7-LTS +jit [arm64-darwin]

jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913 OpenJDK 64-Bit Server VM 17.0.7+7-LTS on 17.0.7+7-LTS +jit [x86_64-linux]

  • Operating system and platform (e.g. uname -a)

MacOS Ventura 13.4,
Darwin Mohameds-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64

Linux ip-172-30-0-20 5.15.0-1037-aws #41~20.04.1-Ubuntu SMP Mon May 22 18:18:00 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions