You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2009/05/22 22:17:05 UTC

svn commit: r777690 - /incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TFramedTransport.java

Author: bryanduxbury
Date: Fri May 22 20:17:04 2009
New Revision: 777690

URL: http://svn.apache.org/viewvc?rev=777690&view=rev
Log:
THRIFT-516. rb: If TFramedTransport reads a negative frame size, throw a TTransportException descendant instead of the default NegativeArraySizeException

Throw a TTransportException when the frame size read from the wire is < 0.


Modified:
    incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TFramedTransport.java

Modified: incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TFramedTransport.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TFramedTransport.java?rev=777690&r1=777689&r2=777690&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TFramedTransport.java (original)
+++ incubator/thrift/trunk/lib/java/src/org/apache/thrift/transport/TFramedTransport.java Fri May 22 20:17:04 2009
@@ -96,6 +96,10 @@
       ((i32rd[2] & 0xff) <<  8) |
       ((i32rd[3] & 0xff));
 
+    if (size < 0) {
+      throw new TTransportException("Read a negative frame size (" + size + ")!");
+    }
+    
     byte[] buff = new byte[size];
     transport_.readAll(buff, 0, size);
     readBuffer_ = new ByteArrayInputStream(buff);