[
https://issues.apache.org/jira/browse/SOLR-7983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14716760#comment-14716760
]
Shalin Shekhar Mangar commented on SOLR-7983:
---------------------------------------------
Haha, yes, of course. I am not reading right :) I'll fix the description and
the entry in CHANGES.txt
> Utils.toUTF8 uses shorter buffer than necessary for holding UTF8 data
> ---------------------------------------------------------------------
>
> Key: SOLR-7983
> URL: https://issues.apache.org/jira/browse/SOLR-7983
> Project: Solr
> Issue Type: Bug
> Affects Versions: 5.3
> Reporter: Shalin Shekhar Mangar
> Assignee: Shalin Shekhar Mangar
> Priority: Trivial
> Fix For: Trunk, 5.4
>
>
> Method in question:
> {code}
> public static byte[] toUTF8(CharArr out) {
> byte[] arr = new byte[out.size() << 2]; // is 4x the real worst-case
> upper-bound?
> int nBytes = ByteUtils.UTF16toUTF8(out, 0, out.size(), arr, 0);
> return Arrays.copyOf(arr, nBytes);
> }
> {code}
> The byte array should be at least out.size() * 3.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]