Skip to content

Commit 4693eb8

Browse files
committed
Netty 4 IndexOutOfBoundException during bounds checks (fixes lmdbjava#113)
1 parent 7659c70 commit 4693eb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/java/org/lmdbjava/ByteBufProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ protected ByteBuf out(final ByteBuf buffer, final Pointer ptr,
140140
final long addr = UNSAFE.getLong(ptrAddr + STRUCT_FIELD_OFFSET_DATA);
141141
final long size = UNSAFE.getLong(ptrAddr + STRUCT_FIELD_OFFSET_SIZE);
142142
UNSAFE.putLong(buffer, ADDRESS_OFFSET, addr);
143-
UNSAFE.putLong(buffer, LENGTH_OFFSET, (int) size);
144-
buffer.readerIndex(0).writerIndex((int) size);
143+
UNSAFE.putInt(buffer, LENGTH_OFFSET, (int) size);
144+
buffer.writerIndex((int) size).readerIndex(0);
145145
return buffer;
146146
}
147147
}

0 commit comments

Comments
 (0)