You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2015/08/27 16:16:45 UTC

[jira] [Commented] (SOLR-7983) Utils.toUTF8 uses shorter buffer than necessary for holding UTF8 data

    [ https://issues.apache.org/jira/browse/SOLR-7983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14716737#comment-14716737 ] 

ASF subversion and git services commented on SOLR-7983:
-------------------------------------------------------

Commit 1698160 from shalin@apache.org in branch 'dev/trunk'
[ https://svn.apache.org/r1698160 ]

SOLR-7983: Utils.toUTF8 uses shorter buffer than necessary for holding UTF8 data

> 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
>            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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org