SonarQube Version 8.9
Hi all,
I compiled an image with ASAN(AddressSanitizer) for our arm machine, the source code with structure showed below passed compiling and has no error in SonarQube analysis.
But, in fact, the code caused issues when executing on the arm machine,
pclose will not set a FILE pointer to null, thus this code pclose a FILE pointer twice and caused a double freed issues on the machine, and caught by ASAN.
Shouldn’t this kind of error be caught by SonarQube?
void function()
{
FILE *fd;
fd = popen(MY_PATH, "r");
if (fgets(SOME_CHAR_ARRAY, 256, fd) == NULL)
goto end;
pclose(fd);
end:
if (fd) pclose(fd);
return;
Wonder if I misunderstand the issue or it’s a bug in SonarQube.