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

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

Open
acgetchell opened this issue Mar 22, 2022 · 2 comments
Open

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

acgetchell opened this issue Mar 22, 2022 · 2 comments

Comments

@acgetchell
Copy link
Contributor

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
@jaredgrubb
Copy link
Member

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

@acgetchell
Copy link
Contributor Author

acgetchell commented Mar 31, 2022

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants