From 487fd2e0435db0326a60821bcc96e56fa2eee711 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 9 Mar 2010 05:19:11 +0000 Subject: [PATCH] THRIFT-657. java: Detect negative length in TBinaryProtocol git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920658 13f79535-47bb-0310-9956-ffa450edef68 --- lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java b/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java index 83c85e16..16c7567c 100644 --- a/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java +++ b/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java @@ -365,6 +365,9 @@ public class TBinaryProtocol extends TProtocol { } protected void checkReadLength(int length) throws TException { + if (length < 0) { + throw new TException("Negative length: " + length); + } if (checkReadLength_) { readLength_ -= length; if (readLength_ < 0) { -- 2.17.1