2012/2/21  <ma...@apache.org>:
> Author: markt
> Date: Mon Feb 20 22:54:13 2012
> New Revision: 1291507
>
> URL: http://svn.apache.org/viewvc?rev=1291507&view=rev
> Log:
> Ping/pong support
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
>    tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
>    tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
>
> Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291507&r1=1291506&r2=1291507&view=diff
>

Regarding StreamInbound#doClose(), doPing(), doPong()

1. in doClose():
status = status + is.read();
There is no check whether is.read() is not -1 above.

2.All 3 methods have such loops:
            while (read > -1) {
                data.position(data.position() + read);
                read = is.read(data.array(), data.position(), data.remaining());
            }

I am not sure what happens if data.remaining() becomes 0 but there are
still data in the stream, e.g. from ill-intended client.  I think that
if there is more data than buffer can handle it will hang looping
indefinitely with read=0.

3. doPong() method has unbounded while() loop. It wouldn't hang, but I
think it is bad that there is no control on how many data are
consumed.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to