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

Fixed potentially uninitialized variable #41

Merged
merged 1 commit into from
Jul 10, 2024
Merged

Fixed potentially uninitialized variable #41

merged 1 commit into from
Jul 10, 2024

Conversation

antoine21839
Copy link
Contributor

In the case where the file has reached the end, readBin doesn't initialize the "bytes" variable. It therefore contains garbage values, which has a small chance of making the switch select another case than "default", leading to an infinite loop. This isn't just speculation, this has actually happened to me while compiling in Unreal 5.3. It is worth mentionning that the idiomatic way of checking whether or not the file has reached the end is to use file.eof() instead of relying on the fact that the variable isn't touched by "read".

In the case where the file has reached the end, readBin doesn't initialize the "bytes" variable. It therefore contains garbage values, which has a small chance of making the switch select another case than "default", leading to an infinite loop. This isn't just speculation, this has actually happened to me while compiling in Unreal 5.3.
It is worth mentionning that the idiomatic way of checking whether or not the file has reached the end is to use file.eof() instead of relying on the fact that the variable isn't touched by "read".
@Yida-Lin Yida-Lin merged commit 45dbf90 into xdf-modules:main Jul 10, 2024
10 checks passed
@Yida-Lin
Copy link
Member

Thanks Antoine!

@antoine21839 antoine21839 deleted the patch-1 branch July 10, 2024 08:10
@antoine21839
Copy link
Contributor Author

Hello again, do you plan on releasing a new pre-compiled version of libxdf soon ? Latest one dates back from 2021. That would be much easier for me to use a compiled version instead of compiling it myself.

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.

2 participants