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

utree: Fixed negative value shift #423

Merged
merged 1 commit into from Nov 25, 2018

Conversation

Projects
None yet
1 participant
@Kojoley
Copy link
Collaborator

commented Nov 23, 2018

Result of shifting a negative value is an implementation defined behavior.

UBSan output:

boost/spirit/home/support/utree/detail/utree_detail2.hpp:47:48: runtime error: left shift of negative value -128
    #0 0x45cc72 in boost::spirit::detail::fast_string::tag() const ~/boost-root/./boost/spirit/home/support/utree/detail/utree_detail2.hpp:47:48
    #1 0x45c94c in boost::spirit::utree::copy(boost::spirit::utree const&) ~/boost-root/./boost/spirit/home/support/utree/detail/utree_detail2.hpp:1502:31
    #2 0x440cc7 in boost::spirit::utree::operator=(boost::spirit::utree const&) ~/boost-root/./boost/spirit/home/support/utree/detail/utree_detail2.hpp:848:13
    #3 0x43ce6f in main ~/boost-root/libs/spirit/test/support/utree.cpp:492:16
    #4 0x7f5d472bc2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #5 0x4088c9 in _start (~/boost-root/bin.v2/libs/spirit/test/support/support_utree.test/undefined/clang-linux-7/debug/visibility-hidden/support_utree+0x4088c9)

The temporaries and memcpy calls will be completely optimized out.

utree: Fixed negative value shift
Result of shifting a negative value is an implementation defined behavior.

The temporaries and memcpy calls will be completely optimized out.
@Kojoley

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 23, 2018

There are bunch of other UBs in utree implementation, but solving them will require a rewrite of utree and components data layouts what I am not eager to do.

@Kojoley Kojoley merged commit ca76771 into boostorg:develop Nov 25, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Kojoley Kojoley deleted the Kojoley:fix-utree-negative-shift-ub branch Nov 25, 2018

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