Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7367

ArrayIndexOutOfBoundsException in getCreateArraySignature on too many function parameters

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.9
    • Fix Version/s: None
    • Component/s: class generator
    • Labels:
    • Environment:
      OSX 10.10.2
      Groovy Version: 2.3.9 JVM: 1.7.0_75 Vendor: Oracle Corporation OS: Mac OS X

      Description

      When trying to pass too many arguments to a function Groovy crashes. This crashes even if the code is never called.
      Discovered when trying to automatically generate a Gradle project configuration from a different build system. Ended up listing over 280 directories in a single argument list.
      Tested only against 2.3.9.
      Setting priority to Critical only because it's the suggested priority for crashes.

      $ groovy params.groovy 
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      General error during class generation: 255
      
      java.lang.ArrayIndexOutOfBoundsException: 255
      	at org.codehaus.groovy.classgen.asm.CallSiteWriter.getCreateArraySignature(CallSiteWriter.java:55)
      	at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:314)
      	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:281)
      	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:366)
      	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:99)
      	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:83)
      	at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:433)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:749)
      	at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:582)
      	at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeReturn(OptimizingStatementWriter.java:316)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:606)
      	at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81)
      	at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:556)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:420)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:377)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:497)
      	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1064)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:231)
      	at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:805)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1047)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:286)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:259)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:674)
      	at groovy.lang.GroovyShell.run(GroovyShell.java:501)
      	at groovy.lang.GroovyShell.run(GroovyShell.java:491)
      	at groovy.ui.GroovyMain.processOnce(GroovyMain.java:650)
      	at groovy.ui.GroovyMain.run(GroovyMain.java:381)
      	at groovy.ui.GroovyMain.process(GroovyMain.java:367)
      	at groovy.ui.GroovyMain.processArgs(GroovyMain.java:126)
      	at groovy.ui.GroovyMain.main(GroovyMain.java:106)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)
      	at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)
      
      1 error
      

        Attachments

        1. params.groovy
          1 kB
          Artur Matuszewski

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              arturm Artur Matuszewski
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: