[#4841] Fix segfault if UnpooledUnsafeHeapByteBuf.getShort(..) is used and UNALGINED access is not possible.

Motivation:

We missed to take the byte[] into account when try to access the bytes and so produce a segfault.

Modifications:

Correctly pass the byte[] in.

Result:

No more segfault.
This commit is contained in:
Norman Maurer 2016-02-04 22:18:03 +01:00
parent 75a2ddd61c
commit 19907030d1
1 changed files with 2 additions and 1 deletions

View File

@ -251,7 +251,8 @@ final class UnsafeByteBufUtil {
short v = PlatformDependent.getShort(array, index);
return BIG_ENDIAN_NATIVE_ORDER ? v : Short.reverseBytes(v);
}
return (short) (PlatformDependent.getByte(index) << 8 | PlatformDependent.getByte(index + 1) & 0xff);
return (short) (PlatformDependent.getByte(array, index) << 8 |
PlatformDependent.getByte(array, index + 1) & 0xff);
}
static short getShortLE(byte[] array, int index) {