[FlexBuffers][Java] Fix wrong access to a string using Reference::asString(). (#5532)

The real position of a string is  calculated by using the indirect() method,
which should be based on parentWidth and not byteWidth, as it was implemented.

We are also fixing the flag BUILDER_FLAG_SHARE_STRINGS on FlexBuffersBuilder
that was set as '1', same value as BUILDER_FLAG_SHARE_KEYS.
This commit is contained in:
Paulo Pinheiro
2019-09-25 20:59:10 +02:00
committed by Wouter van Oortmerssen
parent cbdf82e2fb
commit 0798b7b698
3 changed files with 43 additions and 3 deletions

View File

@@ -481,7 +481,7 @@ public class FlexBuffers {
*/
public String asString() {
if (isString()) {
int start = indirect(bb, end, byteWidth);
int start = indirect(bb, end, parentWidth);
int size = readInt(bb, start - byteWidth, byteWidth);
return Utf8.getDefault().decodeUtf8(bb, start, size);
}