fix illegal memory access when input file does not end with line break

(0) -30 -10 -1 +1 +10 tip

mercurial