analyzer icon indicating copy to clipboard operation
analyzer copied to clipboard

Add support for the detection of `CWE-562`

Open mrstanb opened this issue 9 months ago • 3 comments

CWE-562 is concerned with the issue of returning an address of a stack variable.

Here's a minimal example of a program that has a CWE-562 weakness:

char *cwe562() {
  char *str;
  return str;
}

I'm not sure if there are any SV-COMP Memory Safety cases for this CWE number (most likely not, at least from what I recall). Nonetheless, I think it'd be useful to have a detection mechanism in Goblint for this type of weakness. In addition, it could potentially be even brought into SV-COMP's Memory Safety category if it'd make sense.

I'll make sure to open a separate PR for this soon.

mrstanb avatar Nov 08 '23 22:11 mrstanb