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

munit_assert_string_equal on two null pointers provoque SEGFAULT #61

Open
crazyhouse33 opened this issue Apr 9, 2020 · 0 comments
Open

Comments

@crazyhouse33
Copy link

Hi, I just cloned master from this repo and used you code on my debian machine.

Hi, take a look at that gdb session that illustrate the problem:

11			munit_assert_string_equal(argc[i], expected[i]);
2: argc[i] = 0x0
3: expected[i] = 0x0
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse2_unaligned ()
    at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
31	../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: Aucun fichier ou dossier de ce type.

I understand the bug but I feel that it maybe a good idea to add a check that checks for the NULL == NULL(actually checking that two pointers are equals should be stronger and include more use cases) case on your asserts since a lot of function return NULL when they should return whatever the pointer to indicate a fail. And for automation testing sometimes by using your asserts on my expected result list I ran into the problem twice already. I don't see drawbacks of checking the case but you are more suited to think about what could go wrong. It would save some testcase re-arranging. Thanks for your work tho.

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

1 participant