A corrupt file with a segment length of 0 could cause this to infinite loop.