Skip to content

Fix intermittent host tests failure #4932

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

Merged
merged 2 commits into from
Jul 17, 2018
Merged

Conversation

earlephilhower
Copy link
Collaborator

MD5Builder tests have been randomly, non-repeatably failing due to a problem
with the returned value of MD5Builder.

Valgrind detected a strncpy with an overlapping memory range, which is
an undefined operation. Fix it with a memmove instead, and get rid
of a couple #define redefinitions which were causing compile warnings
on the host side as well.

@earlephilhower
Copy link
Collaborator Author

Valgrind reported error trace:

==24970== 216 errors in context 1 of 1:
==24970== Source and destination overlap in strncpy(0x5ba74a3, 0x5ba74a4, 99)
==24970==    at 0x4C31626: __strncpy_sse2_unaligned (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24970==    by 0x4BAD0D: String::remove(unsigned int, unsigned int) (WString.cpp:725)
==24970==    by 0x4B63B2: StreamString::read() (StreamString.cpp:49)
==24970==    by 0x4B65A2: Stream::timedRead() (Stream.cpp:33)
==24970==    by 0x4B7031: Stream::readBytes(char*, unsigned long) (Stream.cpp:211)
==24970==    by 0x4B6530: Stream::readBytes(unsigned char*, unsigned long) (Stream.h:91)
==24970==    by 0x4C65FD: MD5Builder::addStream(Stream&, unsigned long) (MD5Builder.cpp:56)
==24970==    by 0x418FD9: ____C_A_T_C_H____T_E_S_T____56() (test_md5builder.cpp:63)
==24970==    by 0x4499AB: Catch::FreeFunctionTestCase::invoke() const (catch.hpp:5874)
==24970==    by 0x41EF38: Catch::TestCase::invoke() const (catch.hpp:6779)
==24970==    by 0x444EED: Catch::RunContext::invokeActiveTestCase() (catch.hpp:5473)
==24970==    by 0x44472B: Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (catch.hpp:5445)
==24970== 
==24970== ERROR SUMMARY: 216 errors from 1 contexts (suppressed: 0 from 0)

@earlephilhower
Copy link
Collaborator Author

6 re-runs of the host tests have passed so far, no issues seen.

@@ -51,8 +51,8 @@ TEST_CPP_FILES := \
core/test_md5builder.cpp \


CXXFLAGS += -std=c++11 -Wall -coverage -O0 -fno-common
CFLAGS += -std=c99 -Wall -coverage -O0 -fno-common
CXXFLAGS += -std=c++11 -Wall -coverage -O0 -fno-common -g
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this -g intentional, or left over from debugging?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can pull it out. At some point I want to add in valgrind as part of all host_tests, which will require it back in. We're building w/-o0 already so it's kind of a strange setup already...

MD5Builder tests have been randomly, non-repeatably failing due to a problem
with the returned value of MD5Builder.

Valgrind detected a strncpy with an overlapping memory range, which is
an undefined operation.  Fix it with a memmove instead, and get rid
of a couple #define redefinitions which were causing compile warnings
on the host side as well.
@earlephilhower
Copy link
Collaborator Author

Got 7 clean reruns of host_tests w/o the -g so I think we're good here.

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 this pull request may close these issues.

2 participants