Skip to content

Commit

Permalink
Bug fix for windows line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmu committed Dec 19, 2024
1 parent a136495 commit 3c3b889
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/dataloader/csvreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ func (csvr *csvReader) parseQuotedField(rs *recordState) (kontinue bool, err err
const quoteLen = len(`"`)
dl := len(csvr.delim)
recordStartLine := csvr.numLine
fullField := rs.line
// full copy needed here because we append rs.line to fullField, and this can result in buffer corruption in
// some cases (namely when windows line endings are present)
fullField := make([]byte, len(rs.line))
copy(fullField, rs.line)

// Quoted string field
rs.line = rs.line[quoteLen:]
Expand Down

0 comments on commit 3c3b889

Please sign in to comment.