Skip to content

Crash when AOT compiling rubocop-ast sources #9372

Description

@headius

There's a crash when attempting to load rubocop-ast with forced compilation turned on (JRuby AOT, -X+C flag or -Xcompile.mode=FORCE property):

$ jruby -X+C -e 'require "rubocop-ast"'
Unhandled Java exception: java.lang.ArrayIndexOutOfBoundsException: arraycopy: last source index 33 out of bounds for byte[19]
java.lang.ArrayIndexOutOfBoundsException: arraycopy: last source index 33 out of bounds for byte[19]
                      arraycopy at java/lang/System.java:-2
                         ensure at org/jruby/util/ByteList.java:358
                      strBufCat at org/jruby/util/io/EncodingUtils.java:1944
                      strBufCat at org/jruby/util/io/EncodingUtils.java:1929
                 encCrStrBufCat at org/jruby/util/io/EncodingUtils.java:2052
                 encCrStrBufCat at org/jruby/util/io/EncodingUtils.java:1979
               catWithCodeRange at org/jruby/RubyString.java:1683
               appendIntoString at org/jruby/RubyString.java:2874
                    buildString at org/jruby/ir/targets/indy/BuildDynamicStringSite.java:202
  ️❤ module CallbackCompiler #7 at Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop_minus_ast_minus_1_dot_49_dot_1/lib/rubocop/ast//Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop-ast-1.49.1/lib/rubocop/ast/traversal.rb:28
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:139
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:149
               invokeModuleBody at org/jruby/ir/runtime/IRRuntimeHelpers.java:1922
         ️❤ module Traversal #2 at Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop_minus_ast_minus_1_dot_49_dot_1/lib/rubocop/ast//Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop-ast-1.49.1/lib/rubocop/ast/traversal.rb:25
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:139
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:149
               invokeModuleBody at org/jruby/ir/runtime/IRRuntimeHelpers.java:1922
               ️❤ module AST #1 at Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop_minus_ast_minus_1_dot_49_dot_1/lib/rubocop/ast//Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop-ast-1.49.1/lib/rubocop/ast/traversal.rb:9
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:139
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:149
               invokeModuleBody at org/jruby/ir/runtime/IRRuntimeHelpers.java:1922
           ️❤ module RuboCop #0 at Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop_minus_ast_minus_1_dot_49_dot_1/lib/rubocop/ast//Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop-ast-1.49.1/lib/rubocop/ast/traversal.rb:4
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:139
                           call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:149
               invokeModuleBody at org/jruby/ir/runtime/IRRuntimeHelpers.java:1922
                      ️❤ script at Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop_minus_ast_minus_1_dot_49_dot_1/lib/rubocop/ast//Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop-ast-1.49.1/lib/rubocop/ast/traversal.rb:3
                            run at Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop_minus_ast_minus_1_dot_49_dot_1/lib/rubocop/ast//Users/headius/work/jruby/lib/ruby/gems/shared/gems/rubocop-ast-1.49.1/lib/rubocop/ast/traversal.rb:-1

Something appears to be wrong with a dynamic string it builds at this point in the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions