GitHub user andrewgaul opened a pull request:
https://github.com/apache/thrift/pull/60
Defensively copy binary fields (THRIFT-2233)
This ensures that one consumer of a ByteBuffer does not interfere with
another, e.g.,
MyStruct myStruct = ...;
byte[] array = new byte[myStruct.bufferForValue().capacity()];
someStruct.bufferForValue().get(array);
someStruct.bufferForValue().get(array); // previously, NPE
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/maginatics/thrift defensive-copy
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/60.patch
----
commit 5f7545b1dcd0d94724bc41cfb41bef0d7d4c869d
Author: Andrew Gaul <[email protected]>
Date: 2013-10-22T00:38:15Z
Defensively copy binary fields (THRIFT-2233)
This ensures that one consumer of a ByteBuffer does not interfere with
another, e.g.,
MyStruct myStruct = ...;
byte[] array = new byte[myStruct.bufferForValue().capacity()];
someStruct.bufferForValue().get(array);
someStruct.bufferForValue().get(array); // previously, NPE
----