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

Remove uses of fscanf #1190

Merged
merged 4 commits into from
Jul 22, 2022
Merged

Remove uses of fscanf #1190

merged 4 commits into from
Jul 22, 2022

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Jul 22, 2022

This PR removes several uses of C fscanf functionality. Using it directly is unsafe because numeric overflow yields undefined behavior which may crash the program in the worst case. Using C++ equivalents is less problematic, because numeric overflow is well defined there.

A test for changed serialization implementations has been added where possible. A couple of small fixes needed for tests are also included into the PR.

C99 specifies that numeric overflow when reading numbers in fscanf leads
to undefined behavior. Which menas that malformed input is allowed to
crash the program. iostreams do not have this problem since C++11.
C99 specifies that numeric overflow when reading numbers in fscanf leads
to undefined behavior. Which menas that malformed input is allowed to
crash the program. iostreams do not have this problem since C++11.
@p12tic p12tic changed the title Remove uses of scanf Remove uses of fscanf Jul 22, 2022
@p12tic
Copy link
Contributor Author

p12tic commented Jul 22, 2022

Windows CI is failing due to network problems.

@simogasp simogasp added this to the 2.5.0 milestone Jul 22, 2022
@fabiencastan fabiencastan merged commit 163a24b into alicevision:develop Jul 22, 2022
@p12tic p12tic deleted the remove-scanf branch July 22, 2022 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants