[llvm-bugs] [Bug 26221] New: Spurious use after free warning

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 20 05:36:41 PST 2016


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

            Bug ID: 26221
           Summary: Spurious use after free warning
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: sitsofe at yahoo.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15677
  --> https://llvm.org/bugs/attachment.cgi?id=15677&action=edit
C program that demonstrates spurious use after free warning

Description of the problem:
Code that copies data being pointed at into a new variable which goes on to
then free the original pointer triggers a spurious use after free error.

Steps to reproduce:
1. Compile the attached C program using
scan-build-3.8 cc -O1 spurious-use-after-free.c -c

Expected results:
No warnings.

Actual results:
# scan-build-3.8 cc -O1 spurious-use-after-free.c -c
scan-build: Using '/usr/lib/llvm-3.8/bin/clang' for static analysis
spurious-use-after-free.c:15:5: warning: Use of memory after it is freed
    return item->next; // Flagged as use after free
    ^~~~~~~~~~~~~~~~~
1 warning generated.
scan-build: 1 bug found.
scan-build: Run 'scan-view /tmp/scan-build-2016-01-20-133203-7599-1' to examine
bug reports.

Additional information:
This problem was identified and the reduced test case was produced by Barry
Davis of StorMagic.

Version information:
LLVM packages installed from http://llvm.org/apt/wily/
Ubuntu clang version 3.8.0-svn257294-1~exp1 (trunk) (based on LLVM 3.8.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

-- 
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/20160120/2db70051/attachment-0001.html>


More information about the llvm-bugs mailing list