You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Andrew Zhang (JIRA)" <ji...@apache.org> on 2006/08/14 09:10:13 UTC

[jira] Created: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

[classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-1164
                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Andrew Zhang


java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message. 
Following test reproduces the bug:
public void test_Socket() throws Exception {
        final ServerSocket ss = new ServerSocket(0);
        // Malformed proxy server thread
        new Thread() {
            public void run() {
                try {
                    ss.accept().close();
                } catch (IOException e) {
                    // ignore
                } finally {
                    try {
                        ss.close();
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }

        }.start();
        SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
                .getLocalPort());
        Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
        Socket s = new Socket(proxy);
        SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
        try {
            s.connect(destAddress);
            fail("should throw SocketException");
        } catch (SocketException e) {
            // expected
        }
    }
The test passes against RI while fails against Harmony.
I'll upload a patch to fix this problem soon. Thanks!

Best regards,
Andrew

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

        

[jira] Updated: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1164?page=all ]

Andrew Zhang updated HARMONY-1164:
----------------------------------

    Attachment: Harmony-1164.diff

Hi,

Would you please try my patch?

Thanks!

Best regards,
Andrew

> [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1164
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Attachments: Harmony-1164.diff
>
>
> java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message. 
> Following test reproduces the bug:
> public void test_Socket() throws Exception {
>         final ServerSocket ss = new ServerSocket(0);
>         // Malformed proxy server thread
>         new Thread() {
>             public void run() {
>                 try {
>                     ss.accept().close();
>                 } catch (IOException e) {
>                     // ignore
>                 } finally {
>                     try {
>                         ss.close();
>                     } catch (IOException e) {
>                         // ignore
>                     }
>                 }
>             }
>         }.start();
>         SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
>                 .getLocalPort());
>         Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
>         Socket s = new Socket(proxy);
>         SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
>         try {
>             s.connect(destAddress);
>             fail("should throw SocketException");
>         } catch (SocketException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this problem soon. Thanks!
> Best regards,
> Andrew

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

        

[jira] Assigned: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1164?page=all ]

Paulex Yang reassigned HARMONY-1164:
------------------------------------

    Assignee: Paulex Yang

> [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1164
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>         Attachments: Harmony-1164.diff
>
>
> java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message. 
> Following test reproduces the bug:
> public void test_Socket() throws Exception {
>         final ServerSocket ss = new ServerSocket(0);
>         // Malformed proxy server thread
>         new Thread() {
>             public void run() {
>                 try {
>                     ss.accept().close();
>                 } catch (IOException e) {
>                     // ignore
>                 } finally {
>                     try {
>                         ss.close();
>                     } catch (IOException e) {
>                         // ignore
>                     }
>                 }
>             }
>         }.start();
>         SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
>                 .getLocalPort());
>         Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
>         Socket s = new Socket(proxy);
>         SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
>         try {
>             s.connect(destAddress);
>             fail("should throw SocketException");
>         } catch (SocketException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this problem soon. Thanks!
> Best regards,
> Andrew

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

        

[jira] Commented: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1164?page=comments#action_12428048 ] 
            
Andrew Zhang commented on HARMONY-1164:
---------------------------------------

Hi Paulex,

The fix looks good. Thanks a lot! 

Yes, the test  is unstable. Thank you for pointing out the problem. If I (or community) have good solution, I'll add a stable regression test by a seperated JIRA.  Would you please close this issue? Thanks!

Best regards,
Andrew

> [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1164
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>         Attachments: Harmony-1164.diff
>
>
> java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message. 
> Following test reproduces the bug:
> public void test_Socket() throws Exception {
>         final ServerSocket ss = new ServerSocket(0);
>         // Malformed proxy server thread
>         new Thread() {
>             public void run() {
>                 try {
>                     ss.accept().close();
>                 } catch (IOException e) {
>                     // ignore
>                 } finally {
>                     try {
>                         ss.close();
>                     } catch (IOException e) {
>                         // ignore
>                     }
>                 }
>             }
>         }.start();
>         SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
>                 .getLocalPort());
>         Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
>         Socket s = new Socket(proxy);
>         SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
>         try {
>             s.connect(destAddress);
>             fail("should throw SocketException");
>         } catch (SocketException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this problem soon. Thanks!
> Best regards,
> Andrew

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

        

[jira] Resolved: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1164?page=all ]

Paulex Yang resolved HARMONY-1164.
----------------------------------

    Resolution: Fixed

Andrew, patch partly applied at revision r431544, thanks a lot for this enhancement.  I left the regression tests, because it is multi-thread and depends on thread racing condition, i.e., it may be unstable if the ServerSocket.accept() cannot get CPU time, but of course, the bug report and fix itself is valid. If you got another stable regression test, please attach another patch and I will apply it. Please verify that the problem is fully fixed as you expected.


> [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1164
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>         Attachments: Harmony-1164.diff
>
>
> java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message. 
> Following test reproduces the bug:
> public void test_Socket() throws Exception {
>         final ServerSocket ss = new ServerSocket(0);
>         // Malformed proxy server thread
>         new Thread() {
>             public void run() {
>                 try {
>                     ss.accept().close();
>                 } catch (IOException e) {
>                     // ignore
>                 } finally {
>                     try {
>                         ss.close();
>                     } catch (IOException e) {
>                         // ignore
>                     }
>                 }
>             }
>         }.start();
>         SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
>                 .getLocalPort());
>         Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
>         Socket s = new Socket(proxy);
>         SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
>         try {
>             s.connect(destAddress);
>             fail("should throw SocketException");
>         } catch (SocketException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this problem soon. Thanks!
> Best regards,
> Andrew

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

        

[jira] Closed: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1164?page=all ]

Paulex Yang closed HARMONY-1164.
--------------------------------


Verified by Andrew.

> [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1164
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>         Attachments: Harmony-1164.diff
>
>
> java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message. 
> Following test reproduces the bug:
> public void test_Socket() throws Exception {
>         final ServerSocket ss = new ServerSocket(0);
>         // Malformed proxy server thread
>         new Thread() {
>             public void run() {
>                 try {
>                     ss.accept().close();
>                 } catch (IOException e) {
>                     // ignore
>                 } finally {
>                     try {
>                         ss.close();
>                     } catch (IOException e) {
>                         // ignore
>                     }
>                 }
>             }
>         }.start();
>         SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
>                 .getLocalPort());
>         Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
>         Socket s = new Socket(proxy);
>         SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
>         try {
>             s.connect(destAddress);
>             fail("should throw SocketException");
>         } catch (SocketException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this problem soon. Thanks!
> Best regards,
> Andrew

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