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

Test #1: message ***Failed #20

Open
Ales999 opened this issue Nov 13, 2018 · 1 comment
Open

Test #1: message ***Failed #20

Ales999 opened this issue Nov 13, 2018 · 1 comment

Comments

@Ales999
Copy link

Ales999 commented Nov 13, 2018

Hello.
After build and run:

ctest -C Debug .

first test is fails, other tests is ok.

message.cpp:
...
message::~message()
{
if (m_data != nullptr) {
#ifdef NDEBUG
nn_freemsg(m_data);
#else
if (nn_freemsg(m_data) != 0) { // !!! THIS Fails !!!
std::fprintf(stderr, "warning: nn_freemsg: %s\n", strerror());
}
#endif
}
}
...

Build and compile with VS 2017 with last updates.
Using stable 'nanomsg', version v1.1.5

2018-11-13 15 18 28

chhinze added a commit to chhinze/nanomsgxx that referenced this issue Nov 14, 2018
- define preprocessor variable `NDEBUG=1`, when CMAKE_BUILD_TYPE is not
Debug (cause issue achille-roussel#20)
- fix overflowing buffer in test_message with strcpy.
strcpy also copied terminating '\0', which lead to length 13 (buffer
overflow) and failiure of nnxx_check() in test_message.cpp, l. 49
- simplify detection of test case locations in CMake
- more convenient output directory locations
@chhinze
Copy link
Contributor

chhinze commented Nov 14, 2018

Macro variable NDEBUG=1 was not defined in CMakeLists. Further, there was a buffer overflow due to std::strcpy appending a trailing \0 character. Does PR #21 solve this problem?

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

No branches or pull requests

2 participants