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

Potential false negative: misuse-of-free #12

Open
evintila opened this issue Sep 18, 2024 · 1 comment
Open

Potential false negative: misuse-of-free #12

evintila opened this issue Sep 18, 2024 · 1 comment

Comments

@evintila
Copy link

Dear EffectiveSan authors,

We have noticed that EffectiveSan, under certain conditions, does not detect misuses of free (CWE-761), and are wondering if this is expected behavior.

The misuse in the following example is not detected:

#include <stdlib.h>

int main()
{
  char *p = malloc(16);
  free(p + 8);
  return 0;
}

Compiler versions used:

clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-unknown-linux-gn

git commit d4604a286f7d303c4cc50f9a43eda2b66f679514

Flags used: -fsanitize=effective -O2

@GJDuck
Copy link
Owner

GJDuck commented Sep 19, 2024

This one is real. The current implementation of effective_free(p) allows p to point anywhere in the object, and not restricted to just the base pointer.

This is not an inherent limitation of EffectiveSan, just a quirk of the current implementation. It should be easy to fix, so I will keep the issue open.

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