Closed edmw closed 5 years ago
I added pull request #48 to fix this very thing yesterday. I too encountered this when leaf was scanning the beginning of of file for #//.
let isEntirelyCommentLine: Bool = (peek(by: -4) == .newLine)
Fixed by #48, thanks!
Affected version: 1.1.2
With some of my leaf templates the method
peek
ofTemplateByteScanner
will be called with a negative amount. When the current pointer is less than the absolute amount this will cause a Fatal Error: Index out of range.Adding a guard
pointer + amount >= 0 else return nil
fixed this for me.The good thing is, the former version using an unsafe pointer most likely resulted in a buffer overflow.