mirror of https://github.com/apache/lucene.git
SOLR-7983: Utils.toUTF8 uses shorter buffer than necessary for holding UTF8 data
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1698160 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
90e775cd5b
commit
f8eaccd19f
|
@ -84,7 +84,7 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static byte[] toUTF8(CharArr out) {
|
||||
byte[] arr = new byte[out.size() << 2]; // is 4x the real worst-case upper-bound?
|
||||
byte[] arr = new byte[out.size() * 3];
|
||||
int nBytes = ByteUtils.UTF16toUTF8(out, 0, out.size(), arr, 0);
|
||||
return Arrays.copyOf(arr, nBytes);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue