You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MessageBuffer.putByteBuffer corrupts copies from sliced or read-only heap buffers #1036
MessageBuffer.putByteBuffer copies incorrect bytes or writes to the wrong positions for sliced and read-only sources in the default Unsafe-backed implementation.
Three valid-input cases:
Sliced heap source: wrap [9, 1, 2, 3], set its position to 1, and pass source.slice() with length 3. The destination receives [9, 1, 2] instead of [1, 2, 3], because the source array offset is omitted.
Read-only heap source into a sliced heap destination: the fallback writes at index in the backing array, ignoring the destination slice's array offset. Bytes before the destination slice can be overwritten.
Read-only heap source into a direct destination: every loop iteration writes at address + index, so only the last source byte survives at that position.
Reproduced on current main with OpenJDK 21 on Linux x86_64. A regression matrix covering heap/direct storage, read-only sources, source/destination slices, and zero/partial lengths fails in 10 of 64 cases before the fix. It also checks source position, limit and mark, and destination bytes outside the copied range.
Activity