[ 
https://issues.apache.org/jira/browse/THRIFT-5383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17310997#comment-17310997
 ] 

Jens Geyer edited comment on THRIFT-5383 at 3/29/21, 9:25 PM:
--------------------------------------------------------------

> this line appears to be unnecessary.

I think "misplaced" would be the better word here. The check should be placed 
before the read actually happens. Otherwise it makes no sense, it protects 
nothing. And readBinary() lacks the test at all ...


was (Author: jensg):
> this line appears to be unnecessary.

I think "misplaced" would be the better word here. The check should be placed 
before the read actually happens. Otherwise it makes no sense, it protects 
nothing.

> TJSONProtocol Java readString throws on unnecessary bounds check 
> -----------------------------------------------------------------
>
>                 Key: THRIFT-5383
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5383
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.14.0, 0.14.1
>            Reporter: Aaron St. George
>            Priority: Major
>
> [https://github.com/apache/thrift/blob/7e537505f014d8ede86f30a7500136c2f3e99505/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java#L976]
>  this line appears to be unnecessary. The following code works with thrift 
> 0.13.0 and fails with an exception on 0.14.x 
>  TMemoryBuffer buf = new TMemoryBuffer(11); TMemoryBuffer buf = new 
> TMemoryBuffer(11); 
> TJSONProtocol prot = new TJSONProtocol(buf); 
> prot.writeString("yeehaw"); 
> prot.readString();



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to