https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129099

            Bug ID: 129099
           Summary: RFE: add -fanalyzer check for CWE-761 ("Free of
                    Pointer not at Start of Buffer")
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

See https://cwe.mitre.org/data/definitions/761.html

The analyzer ought to warn at least for trivial cases like:

  void *p = __builtin_malloc (1024);
  free (p + 1);

which would likely corrupt the heap.

Should also handle 'realloc'.

Reply via email to