fix bufferoverflow

This commit is contained in:
fariel 2021-08-13 10:29:22 +08:00
parent 293286ea14
commit 70975a0ed5

View File

@ -96,8 +96,8 @@ public class DorisStreamLoadVisitor {
private byte[] joinRows(List<String> rows, int totalBytes) {
if (DorisWriterOptions.StreamLoadFormat.CSV.equals(writerOptions.getStreamLoadFormat())) {
Map<String, Object> props = writerOptions.getLoadProps();
ByteBuffer bos = ByteBuffer.allocate(totalBytes + rows.size());
byte[] lineDelimiter = DorisDelimiterParser.parse(String.valueOf(props.get("row_delimiter")), "\n").getBytes(StandardCharsets.UTF_8);
ByteBuffer bos = ByteBuffer.allocate(totalBytes + rows.size() * lineDelimiter.length);
for (String row : rows) {
bos.put(row.getBytes(StandardCharsets.UTF_8));
bos.put(lineDelimiter);