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

Possible integral overflow in sum_string_vector #892

Closed
trokhymchuk opened this issue Jun 26, 2023 · 0 comments · Fixed by #893
Closed

Possible integral overflow in sum_string_vector #892

trokhymchuk opened this issue Jun 26, 2023 · 0 comments · Fixed by #893

Comments

@trokhymchuk
Copy link
Contributor

I believe there is a possible UB in the sum_string_vector function (CLI11/include/CLI/TypeTools.hpp:1630), in the 1652-1658 lines:

        if(val <= static_cast<double>((std::numeric_limits<std::int64_t>::min)()) ||
           val >= static_cast<double>((std::numeric_limits<std::int64_t>::max)()) ||
           std::ceil(val) == std::floor(val)) {
            output = detail::value_string(static_cast<int64_t>(val));
        } else {
            output = detail::value_string(val);
        }

the val gets casted to the std::int64_t if it is less than min or greater than max value.

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 a pull request may close this issue.

1 participant