"string length overflow" in File:lines iterator function if there's no newline just before EOF

Issue #1383 resolved
Tae Hanazono
created an issue

Related to #1377, so I'm gonna assign this to bartbes.

Consider this code

local file = love.filesystem.newFile("cover.txt", "r")
local lineiter = file:lines()
local title = lineiter()
local arrangement = lineiter() -- string length overflow

Doesn't happen on closed files, but I noticed some bad case implementation. Just a suggestion, just don't seek back to previous position for opened files. It's user responsibility to know that mixing it with File:read will cause the seek pointer to be in undefined position.

I attached the file which cause that problem.

Comments (2)

  1. Log in to comment