Skip to content

Fix stack overflow in gdlpp when handling CR line endings#50

Open
bgermann wants to merge 1 commit intosilnrsi:masterfrom
bgermann:debian-715950
Open

Fix stack overflow in gdlpp when handling CR line endings#50
bgermann wants to merge 1 commit intosilnrsi:masterfrom
bgermann:debian-715950

Conversation

@bgermann
Copy link
Copy Markdown
Contributor

@bgermann bgermann commented Feb 7, 2026

The \r handling code in get() uses a recursive call to get() to peek at the next character. On files using bare \r line endings (classic Mac), every line triggers a nested get() call, leading to unbounded stack growth and a crash.

Replace the recursive get()/unget() with a direct buffer peek, which correctly handles \r\n, bare \r, and \n without recursion.

Fixes #5.

The \r handling code in get() uses a recursive call to get() to
peek at the next character. On files using bare \r line endings
(classic Mac), every line triggers a nested get() call, leading
to unbounded stack growth and a crash.

Replace the recursive get()/unget() with a direct buffer peek,
which correctly handles \r\n, bare \r, and \n without recursion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segfault

1 participant