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

Fix ASAN warning for uint128_union.decode_decimal #1890

Merged

Conversation

2 participants
@wezrule
Copy link
Collaborator

commented Apr 10, 2019

[ RUN      ] uint128_union.decode_decimal
=================================================================
ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffeefbf7750 at pc 0x000105a92279 bp 0x7ffeefbf5ca0 sp 0x7ffeefbf5c98

From nano::uint128_union::decode_dec (), this:
auto result (integer_part.number () * scale + decimal_part.number () * boost::multiprecision::pow (boost::multiprecision::cpp_int (10), (scale_length - decimal_text.length () - 1)));

is an expression template (the decimal_part.number () and result from boost::multiprecision::pow) . It seems that anything used in conjunction with these expression templates needs to be kept in scope as only references are kept within. I have split up the expression into multiple parts.

@wezrule wezrule added the sanitizers label Apr 10, 2019

@wezrule wezrule added this to the V19.0 milestone Apr 10, 2019

@wezrule wezrule requested a review from SergiySW Apr 10, 2019

@wezrule wezrule self-assigned this Apr 10, 2019

@wezrule wezrule merged commit 33e3be0 into nanocurrency:master Apr 10, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@wezrule wezrule deleted the wezrule:fix_asan_uint128_union_decode_decimal branch Apr 10, 2019

@zhyatt zhyatt added this to CP3 (2019-04-10) in V19 Apr 10, 2019

guilhermelawless added a commit to guilhermelawless/nano-node that referenced this pull request Apr 15, 2019

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.