You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Andrew Gaul (JIRA)" <ji...@apache.org> on 2013/10/22 08:04:42 UTC

[jira] [Updated] (THRIFT-2233) Java compiler should defensively copy its binary inputs

     [ https://issues.apache.org/jira/browse/THRIFT-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Gaul updated THRIFT-2233:
--------------------------------

    Attachment: THRIFT-2233.patch

Pull request available at:

https://github.com/apache/thrift/pull/60

> Java compiler should defensively copy its binary inputs
> -------------------------------------------------------
>
>                 Key: THRIFT-2233
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2233
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Compiler
>    Affects Versions: 0.9
>            Reporter: Andrew Gaul
>             Fix For: 0.9.2
>
>         Attachments: THRIFT-2233.patch
>
>
> Currently if someone calls the bufferForField accessor then calls ByteBuffer.get, this mutates the struct's ByteBuffer field.  Subsequent calls to bufferForField return the mutated field and thus calls to ByteBuffer.get return unexpected results.
> {noformat}
>     MyStruct myStruct = ...;
>     byte[] array = new byte[myStruct.bufferForValue().capacity()];
>     someStruct.bufferForValue().get(array);
>     someStruct.bufferForValue().get(array);  // previously, NPE
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1#6144)