Author: dreiss
Date: Tue Mar  9 05:19:11 2010
New Revision: 920658

URL: http://svn.apache.org/viewvc?rev=920658&view=rev
Log:
THRIFT-657. java: Detect negative length in TBinaryProtocol

Modified:
    
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java

Modified: 
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java?rev=920658&r1=920657&r2=920658&view=diff
==============================================================================
--- 
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
 (original)
+++ 
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
 Tue Mar  9 05:19:11 2010
@@ -365,6 +365,9 @@ public class TBinaryProtocol extends TPr
   }
 
   protected void checkReadLength(int length) throws TException {
+    if (length < 0) {
+      throw new TException("Negative length: " + length);
+    }
     if (checkReadLength_) {
       readLength_ -= length;
       if (readLength_ < 0) {


Reply via email to