8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char

Alan Bateman Alan.Bateman at oracle.com
Thu Feb 21 17:57:48 UTC 2019

On 21/02/2019 17:49, Brian Burkhalter wrote:
>> On Feb 21, 2019, at 9:45 AM, Alan Bateman <Alan.Bateman at oracle.com 
>> <mailto:Alan.Bateman at oracle.com>> wrote:
>> On 21/02/2019 17:41, Brian Burkhalter wrote:
>>>> There are a few other places in the heap buffers that also need to 
>>>> be hardened a bit (direct buffers of course need to much more careful).
>>> Shall I try to include fixing those in this patch?
>> Probably best to do it as a separate issue. I try to watch for these 
>> things with direct buffer classes as these could lead to any number 
>> of VM crashes or security issues. It's a less of concern with the 
>> heap buffers but would be good to fix if you have cycles.
> Updated patch below. It’s a little unclear where to put ‘pos = 
> position()’.
remaining() also reads the position  so I think you want:

int pos = src.position();
int lim = src.limit();
int rem = (pos <= lim) ? lim - pos : 0;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190221/2f77e9bc/attachment-0001.html>

More information about the nio-dev mailing list