Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace fputc with ungetc to fix UB #197

Merged
merged 2 commits into from
Oct 1, 2024
Merged

Replace fputc with ungetc to fix UB #197

merged 2 commits into from
Oct 1, 2024

Conversation

dpogue
Copy link
Member

@dpogue dpogue commented Oct 1, 2024

Closes #185.

@Hoikas
Copy link
Member

Hoikas commented Oct 1, 2024

Should we also add a test in the commit prior to the fix to ensure it works?

@dpogue
Copy link
Member Author

dpogue commented Oct 1, 2024

That's a good plan, I'll amend one of the EncryptedStream tests and ensure that it can still decrypt properly after this change.

Given that the original bug with the UB seems system-dependent, I'm not sure I can guarantee that the test would fail before this fix, but I'll see if I can get it going in WSL.

@dpogue
Copy link
Member Author

dpogue commented Oct 1, 2024

Added a test, but it seems to pass both with and without the ungetc fix in CI and locally.

@zrax zrax merged commit 4f51cb0 into H-uru:master Oct 1, 2024
4 checks passed
@dpogue dpogue deleted the ungetc branch October 1, 2024 22:29
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.

DS::FileStream::atEof() UB
3 participants