[llvm-bugs] [Bug 31943] New: Does not detect use of expired pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 13 01:29:20 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=31943

            Bug ID: 31943
           Summary: Does not detect use of expired pointer
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: jpakkane at gmail.com
                CC: llvm-bugs at lists.llvm.org

Scan-build does not detect usage of a pointer that has expired due to going out
of scope. Sample code goes like this:

struct foobar {
  int x;
};

struct baz {
  struct foobar *f;
};

void func(struct foobar *f);
void b(void);

void b() {
  struct baz b;
  {
    struct foobar t;
    b.f = &t; /* Valid here but expires when this block ends. */
  }
  func(b.f); /* <- use of expired pointer here. */
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170213/c130364e/attachment.html>


More information about the llvm-bugs mailing list