Skip to content

MemorySanitizer Warning: Use of Uninitialized Value in MPC protocols execution #1754

@HopeDevote

Description

@HopeDevote

Describe the bug
There is a memory issue during the execution of the soho-party.x program, as detected by the MemorySanitizer. The error suggests the use of uninitialized memory in the STL map while running the soho-party.x program. This occurs during the handling of options and initialization in the ezOptionParser and OnlineOptions classes.

To Reproduce
Compilation and or execution command lines

../MP-SPDZ/soho-party.x 0 test-pn 10666 -h localhost
../MP-SPDZ/soho-party.x 1 test-pn 10666 -h localhost

Observe the error output related to the MemorySanitizer warning.

Error message

==1297801==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4d5ed0 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:1933:7
    #1 0x4d5ed0 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::lower_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:1287:16
    #2 0x4d5ed0 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::lower_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_map.h:1258:21
    #3 0x4d5ed0 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_map.h:515:17
    #4 0x4d4928 in ez::ezOptionParser::add(char const*, bool, int, char, char const*, char const*, char const*, ez::ezOptionValidator*) /app/MP-SPDZ-main/./Tools/ezOptionParser.h:1464:3
    #5 0x7fdf374bb880 in OnlineOptions::OnlineOptions(ez::ezOptionParser&, int, char const**, bool) /app/MP-SPDZ-main/Processor/OnlineOptions.cpp:58:9
    #6 0x7fdf374c03c5 in OnlineOptions::OnlineOptions(ez::ezOptionParser&, int, char const**, int, bool, bool, bool) /app/MP-SPDZ-main/Processor/OnlineOptions.cpp:191:9
    #7 0x4cf2bf in OnlineOptions::OnlineOptions<SohoShare<gfp_<0, 2> >, gf2n_short>(ez::ezOptionParser&, int, char const**, SohoShare<gfp_<0, 2> >, bool, gf2n_short) /app/MP-SPDZ-main/./Processor/OnlineOptions.hpp:14:9
    #8 0x4c0630 in DishonestMajorityFieldMachine<SohoShare, SohoShare, gf2n_short, DishonestMajorityMachine>::DishonestMajorityFieldMachine(int, char const**, ez::ezOptionParser&, bool) /app/MP-SPDZ-main/./Processor/FieldMachine.h:43:23
    #9 0x4c0630 in main /app/MP-SPDZ-main/Machines/soho-party.cpp:37:5
    #10 0x7fdf3661a082 in __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/../csu/libc-start.c:308:16
    #11 0x44349d in _start (/app/MP-SPDZ-main/soho-party.x+0x44349d)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:1933:7 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions