[JIRA] (JENKINS-38908) Script.main(String[]) vs. Script.main() ArrayIndexOutOfBoundsException

0 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 1:37:02 PM10/11/16
to jenkinsc...@googlegroups.com
Jesse Glick started work on Bug JENKINS-38908
 
Change By: Jesse Glick
Status: Open In Progress
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 1:37:04 PM10/11/16
to jenkinsc...@googlegroups.com
Jesse Glick created an issue
 
Jenkins / Bug JENKINS-38908
Script.main(String[]) vs. Script.main() ArrayIndexOutOfBoundsException
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: script-security-plugin
Created: 2016/Oct/11 5:36 PM
Labels: pipeline
Priority: Major Major
Reporter: Jesse Glick

The script

node {
  writeFile file: 'x', text: 'def main() {}; this'
  load('x').main()
}

fails

java.lang.ArrayIndexOutOfBoundsException: 0
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isMoreSpecific(GroovyCallSiteSelector.java:230)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:178)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.method(GroovyCallSiteSelector.java:146)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:78)
    at ...

whereas if you pick a different name it is OK.

Claimed to be a regression in 1.22 though it seems unlikely those changes are related.

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 1:52:01 PM10/11/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-38908
 
Re: Script.main(String[]) vs. Script.main() ArrayIndexOutOfBoundsException

Root cause is that Groovy seems to define a main(String...) method on Script, and the code to pick which of those was being called got confused.

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 1:52:01 PM10/11/16
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Oct 20, 2016, 10:14:01 AM10/20/16
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Bug JENKINS-38908
 
Re: Script.main(String[]) vs. Script.main() ArrayIndexOutOfBoundsException

Code changed in jenkins
User: Jesse Glick
Path:
src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelector.java
src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelectorTest.java
http://jenkins-ci.org/commit/script-security-plugin/fa6f8e3372e3e38fa43bc7b4be09d2d26758beca
Log:
[FIXED JENKINS-38908] Incorrect specificity calculation when varargs are involved.

ryan.campbell@gmail.com (JIRA)

unread,
Jan 26, 2017, 6:16:01 PM1/26/17
to jenkinsc...@googlegroups.com

ryan.campbell@gmail.com (JIRA)

unread,
Jan 26, 2017, 6:16:01 PM1/26/17
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages