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

Use std::round() in float_to_integer_helper #2161

Merged
merged 2 commits into from
Mar 20, 2022

Conversation

kevinbackhouse
Copy link
Collaborator

Fixes: #2160

std::round is double to double, so it just removes the fractional part of the number, which avoids the weird behavior of the static_cast.

@kevinbackhouse kevinbackhouse added bug OSS-Fuzz Bug reported by https://google.github.io/oss-fuzz/ labels Mar 19, 2022
@codecov
Copy link

codecov bot commented Mar 19, 2022

Codecov Report

Merging #2161 (ddc96bc) into main (5d5354e) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2161   +/-   ##
=======================================
  Coverage   62.65%   62.65%           
=======================================
  Files          97       97           
  Lines       19721    19721           
  Branches     9710     9710           
=======================================
  Hits        12357    12357           
  Misses       5132     5132           
  Partials     2232     2232           
Impacted Files Coverage Δ
include/exiv2/value.hpp 84.51% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d5354e...ddc96bc. Read the comment docs.

Copy link
Collaborator

@piponazo piponazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Did you also try to use the POC in 0.27-maintenance? If the error also happens there it would be good to backport the fix.

@kevinbackhouse
Copy link
Collaborator Author

@piponazo: This doesn't affect 0.27-maintenance because float_to_integer_helper is new code that I added in #2062.

@kevinbackhouse kevinbackhouse merged commit 8ffaaab into Exiv2:main Mar 20, 2022
@kevinbackhouse kevinbackhouse deleted the FixIssue2160 branch March 20, 2022 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug OSS-Fuzz Bug reported by https://google.github.io/oss-fuzz/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

float_to_integer_helper doesn't handle fractions correctly
2 participants