8245121: (bf) XBuffer.put(Xbuffer src) can give unexpected result when storage overlaps

Alan Bateman Alan.Bateman at oracle.com
Mon May 18 07:57:07 UTC 2020


On 15/05/2020 19:33, Brian Burkhalter wrote:
> Please review the proposed fix [1] of the issue [2]. This replaces the “loopy” XBuffer.put(XBuffer src) fallback code
>       while (src.hasRemaining())
>           dst.put(src.get());
> with an implementation which behaves as if the source elements were first copied to a temporary array before being written into the target. The test fails before and passes after the implementation change is applied.
>
The approach looks reasonable but I suspect this will need a 
reachability fence for at least src (maybe this too, I need to page some 
of the details).

-Alan


More information about the nio-dev mailing list