Proper bounds check
Closes
@@ -71,12 +71,16 @@ func NewLineArray(size int64, reader io.Reader) *LineArray {
n := 0
for {
data, err := br.ReadBytes('\n')
- if len(data) > 0 && data[len(data)-2] == '\r' {
+ if len(data) > 1 && data[len(data)-2] == '\r' {
data = append(data[:len(data)-2], '\n')
+ if fileformat == 0 {
fileformat = 2
+ }
} else if len(data) > 0 {
+ if fileformat == 0 {
fileformat = 1
}
+ }
if n >= 1000 && loaded >= 0 {
totalLinesNum := int(float64(size) * (float64(n) / float64(loaded)))
