Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix IndexOutOfBound for loaded HDT BigByteBuffer of size > 2^31 #161

Merged
merged 2 commits into from
May 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove implicit cast to long for decoded byte values
  • Loading branch information
ate47 committed May 10, 2022
commit 0ab75be443053d0e3b4385c37d0ec3ab911de5e7
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ public static long decode(ByteBuffer in) throws IOException {
throw new IllegalArgumentException();
}

out |= (readbyte & 127) << shift;
out |= (readbyte & 127L) << shift;

if(!in.hasRemaining()) throw new EOFException();
readbyte = in.get();

shift+=7;
}
out |= (readbyte & 127) << shift;
out |= (readbyte & 127L) << shift;
return out;
}

Expand All @@ -117,14 +117,14 @@ public static long decode(BigMappedByteBuffer in) throws IOException {
throw new IllegalArgumentException();
}

out |= (readbyte & 127) << shift;
out |= (readbyte & 127L) << shift;

if(!in.hasRemaining()) throw new EOFException();
readbyte = in.get();

shift+=7;
}
out |= (readbyte & 127) << shift;
out |= (readbyte & 127L) << shift;
return out;
}

Expand All @@ -149,11 +149,11 @@ public static int decode(byte[] data, int offset, Mutable<Long> value) {
int i=0;
int shift=0;
while( (0x80 & data[offset+i])==0) {
out |= (data[offset+i] & 127) << shift;
out |= (data[offset+i] & 127L) << shift;
i++;
shift+=7;
}
out |= (data[offset+i] & 127) << shift;
out |= (data[offset+i] & 127L) << shift;
i++;
value.setValue(out);
return i;
Expand All @@ -164,11 +164,11 @@ public static int decode(BigByteBuffer data, long offset, Mutable<Long> value) {
int i = 0;
int shift=0;
while( (0x80 & data.get(offset+i))==0) {
out |= (data.get(offset+i) & 127) << shift;
out |= (data.get(offset+i) & 127L) << shift;
i++;
shift+=7;
}
out |= (data.get(offset+i) & 127) << shift;
out |= (data.get(offset+i) & 127L) << shift;
i++;
value.setValue(out);
return i;
Expand Down