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

MunitParameterEnum with NULL value at the beginning leads to segfault #88

Open
slinkinone opened this issue Oct 13, 2022 · 0 comments
Open

Comments

@slinkinone
Copy link

MunitParameterEnum is not correctly processed by munit_suite_main. If value parameter is NULL and located at the beginning of the list it will lead to segfault.

static MunitParameterEnum test_params[] = {
  { (char*) "foo", NULL },  // NULL instead of foo_params
  { (char*) "bar", bar_params },
  { (char*) "baz", NULL },
  { NULL, NULL },
};

gdb example
run
...
Running test suite with seed 0x9e8678ec...
/example/compare                     [Detaching after fork from child process 20542]
[ OK    ] [ 0.00000232 / 0.00000146 CPU ]
/example/rand                        [Detaching after fork from child process 20543]
[ OK    ] [ 0.00000495 / 0.00000472 CPU ]
/example/parameters                  

Program received signal SIGSEGV, Segmentation fault.
0x0000555555558705 in munit_test_runner_run_test_wild ()
(gdb) bt
#0  0x0000555555558705 in munit_test_runner_run_test_wild ()
#1  0x0000555555558b78 in munit_test_runner_run_test ()
#2  0x0000555555558d45 in munit_test_runner_run_suite ()
#3  0x0000555555558e27 in munit_test_runner_run ()
#4  0x000055555555a05d in munit_suite_main_custom ()
#5  0x000055555555a255 in munit_suite_main ()
#6  0x000055555555adef in main ()
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