Skip to content

Commit

Permalink
fix(core): force ByteBuffer position to limit when array has been read
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Aug 30, 2024
1 parent ab7784c commit 3a26e44
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fun ByteBuffer.toByteArray(): ByteArray {
return if (this.hasArray() && !isDirect) {
val offset = position() + arrayOffset()
val array = array()
position(limit())
if (offset == 0 && array.size == remaining()) {
array
} else {
Expand Down

0 comments on commit 3a26e44

Please sign in to comment.