[LLVMbugs] [Bug 18109] New: Malloc error "pointer being freed was not allocated".

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 2 04:22:43 PST 2013


            Bug ID: 18109
           Summary: Malloc error "pointer being freed was not allocated".
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: hr.deepak at tcs.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11642
  --> http://llvm.org/bugs/attachment.cgi?id=11642&action=edit
PluginChecker.cpp: Source code of plugin. .so: plugin build, example.c: C code
on which test is to done error.txt: dump on the terminal run, failure folder
built by clang.

I was trying to build a simple plugin for static analyzer of clang. The plugin
will simply report all the printf function call in a given .c file. It may not
do anything fruitful, but a simple start for me.

I was able to build a dynamic library with the following command.
    g++ -share -fPIC -I~/static_plugin/llvm/include
-I~static_plugin/build/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden
-fno-exceptions -fno-rtti -fno-common -Woverloaded-virtual -Wcast-qual 
-L~/static_plugin/build/Debug+Asserts/lib -lz -lpthread -lcurses -lm -undefined
dynamic_lookup -o PrintfChecker.so PrintfChecker.cpp

When I tested it on a sample C code containing a printf call, a runtime error
is generated. I have attached the error message dumped on terminal as
error.txt. I have also attached the failure folder as zip and the C code as
example.c. I used the following cmd to test the  C code.
--use-analyzer=~/static_plugin/build/Debug+Asserts/bin/clang -load-plugin
./PrintfChecker.so -enable-checker security.PrintfChecker gcc -c example.c

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/20131202/f0617d20/attachment.html>

More information about the llvm-bugs mailing list