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

Get rid of integer overflow in copy_move_algo.hpp (-fsanitize=integer). #109

merged 1 commit into from Mar 30, 2019


Copy link

commented Mar 20, 2019

When running a program with -fsanitize=integer, I get runtime errors on line 514 of copy_move_algo.hpp due to the way the while loop is written:

[...] boost/container/detail/copy_move_algo.hpp:514:15: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'typename boost::container::allocator_traits<new_allocator<pair<unsigned int, __normal_iterator<const unsigned int *, vector<unsigned int, allocator > > > > >::size_type' (aka 'unsigned long')

When the loop terminates, n-- will cause unsigned integer overflow in n. Although the value of n is discarded otherwise, this behavior is likely unwanted and unintentional, thus I'm submitting this PR.

@igaztanaga igaztanaga merged commit c5869d5 into boostorg:develop Mar 30, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented Mar 30, 2019

Thanks for the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.