TCPSocket#new and TCPServer#new crash JRuby when the specified port is out of 
range (negative or bigger than 65k)
-----------------------------------------------------------------------------------------------------------------

                 Key: JRUBY-2874
                 URL: http://jira.codehaus.org/browse/JRUBY-2874
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
         Environment: Latest JRuby
            Reporter: Vladimir Sizikov
            Assignee: Vladimir Sizikov
             Fix For: JRuby 1.1.4


This also crashes current RubySpec run. Fix in progress.

{noformat}
jruby -rsocket -e "TCPServer.new('localhost', -1)"
Exception in thread "main" java.lang.IllegalArgumentException: port out of 
range:-1
        at java.net.InetSocketAddress.<init>(InetSocketAddress.java:101)
        at org.jruby.ext.socket.RubyTCPServer.initialize(RubyTCPServer.java:118)
        at 
org.jruby.ext.socket.RubyTCPServerInvoker$initialize_method_0_1.call(Unknown 
Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:62)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:99)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:294)
        at org.jruby.RubyClass.newInstance(RubyClass.java:413)
        at org.jruby.RubyIO.newInstance(RubyIO.java:800)
        at org.jruby.RubyIOInvoker$newInstance_s_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:259)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:167)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:171)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:435)
{noformat}

{noformat}
jruby -rsocket -e "TCPServer.new('localhost', 2**16)"
Exception in thread "main" java.lang.IllegalArgumentException: port out of 
range:65536
        at java.net.InetSocketAddress.<init>(InetSocketAddress.java:101)
        at org.jruby.ext.socket.RubyTCPServer.initialize(RubyTCPServer.java:118)
        at 
org.jruby.ext.socket.RubyTCPServerInvoker$initialize_method_0_1.call(Unknown 
Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:62)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:99)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:294)
        at org.jruby.RubyClass.newInstance(RubyClass.java:413)
        at org.jruby.RubyIO.newInstance(RubyIO.java:800)
        at org.jruby.RubyIOInvoker$newInstance_s_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:259)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:167)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:171)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:435)
{noformat}

{noformat}
jruby -rsocket -e "TCPSocket.new('localhost', -1)"
Exception in thread "main" java.lang.IllegalArgumentException: port out of 
range:-1
        at java.net.InetSocketAddress.<init>(InetSocketAddress.java:101)
        at org.jruby.ext.socket.RubyTCPSocket.initialize(RubyTCPSocket.java:98)
        at 
org.jruby.ext.socket.RubyTCPSocketInvoker$initialize_method_0_2.call(Unknown 
Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:62)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:99)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:294)
        at org.jruby.RubyClass.newInstance(RubyClass.java:413)
        at org.jruby.RubyIO.newInstance(RubyIO.java:800)
        at org.jruby.RubyIOInvoker$newInstance_s_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:259)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:167)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:171)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:435)
{noformat}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to