-
Notifications
You must be signed in to change notification settings - Fork 97
Description
-
In
main(), on line 1838, there is this call:acutest_cmdline_read_(acutest_cmdline_options_, argc, argc, acutest_cmdline_callback_)
which on line 1438, calls the
callbackargument like this:ret = callback(opt->id, NULL);
where
callbackisacutest_cmdline_callback_). This callback then on line 1681 calls:if (acutest_select_(arg) == 0)
where
argwasNULL. This then (on line 1059) calls:if (strcmp(acutest_list_[i].name, pattern) == 0)
Yet
pattern, the parameter holding the value ofarg, is a null pointer.According to ISO C11, 7.1.4, "Use of library functions":
Each of the following statements applies unless explicitly stated otherwise in the detailed descriptions that follow: If an argument to a function has an invalid value (such as [...] a null pointer [...]) [...], the behavior is undefined.
The description of
strcmp()in 7.24.4 does not state otherwise, so the behavior is undefined, and the above call tostrcmp()invokes undefined behavior.
This was found when compiling the code with -fanalyzer with GCC 13.1.