Skip to content

MSAN Warning on use-of-initialized-value in docopt::docopt_parse #149

Open

Description

@acgetchell

Running my project through MSAN, which uses Docopt.cpp, gives me the following:

WARNING: MemorySanitizer: use-of-uninitialized-value
[1441]()6:     #0 0x434fdc in bcmp (/home/travis/build/acgetchell/CDT-plusplus/build/src/initialize+0x434fdc)
[1442]()6:     #1 0x625c4a in docopt::docopt_parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,

I think the error might be in this line:

docopt::docopt_parse(std::string const& doc,
		     std::vector<std::string> const& argv,
		     bool help,
		     bool version,
		     bool options_first)
{
	Required pattern;
	std::vector<Option> options; // <-- here

Activity

  1. jaredgrubb commented on Mar 25, 2022

    @jaredgrubb
    Member

    Hm, that line invokes the default C++ constructor so it can't be the issue. Does MSAN flag the actual line of code?

  2. acgetchell commented on Mar 31, 2022

    @acgetchell
    ContributorAuthor

    Yeah, saw that. My latest CI build showing the docopt error is here:

    https://app.travis-ci.com/github/acgetchell/CDT-plusplus/jobs/564919580#L1506

    But for easy reference, the text is:

    Test command: /home/travis/build/acgetchell/CDT-plusplus/build/src/initialize "--s" "-n640" "-t4" "-o"
    [1502]()6: Test timeout computed to be: 1500
    [1503]()6: Uninitialized bytes in MemcmpInterceptorCommon at offset 0 inside [0x714000000030, 12)
    [1504]()6: ==9178==WARNING: MemorySanitizer: use-of-uninitialized-value
    [1505]()6:     #0 0x434fdc in bcmp (/home/travis/build/acgetchell/CDT-plusplus/build/src/initialize+0x434fdc)
    [1506]()6:     #1 0x625c4a in docopt::docopt_parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool, bool, bool) (/home/travis/build/acgetchell/CDT-plusplus/build/src/initialize+0x625c4a)
    [1507]()6:     #2 0x629422 in docopt::docopt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/home/travis/build/acgetchell/CDT-plusplus/build/src/initialize+0x629422)
    [1508]()6:     #3 0x4a02cb in main /home/travis/build/acgetchell/CDT-plusplus/build/../src/initialize.cpp:51:66
    [1509]()6:     #4 0x7fd79764b0b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16
    [1510]()6:     #5 0x424ffd in _start (/home/travis/build/acgetchell/CDT-plusplus/build/src/initialize+0x424ffd)
    [1511]()6: 
    [1512]()6: SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/travis/build/acgetchell/CDT-plusplus/build/src/initialize+0x434fdc) in bcmp
    [1513]()6: Exiting
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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