dutor / asan-demo Goto Github PK
View Code? Open in Web Editor NEWDemonstrations of AddresssSanitizer
License: GNU General Public License v3.0
Demonstrations of AddresssSanitizer
License: GNU General Public License v3.0
I tested it locally,
ASAN is inaccurate for placement new
test in C ++
#include <new>
int main () {
char * p1 = new char [sizeof (int)];
int * p2 = new (std::addressof(p1)) int;
delete p2;
}
The error message is as follows:
== 4758 == ERROR: AddressSanitizer: attempting free on address which was not malloc ()-ed: 0x7f415c7f1660 in thread T0
# 0 0x7f4160485105 in operator delete (void *, unsigned long) (/usr/lib64/libasan.so.5+0x111105)
# 1 0x2138336 in nebula :: storage :: AddVerticesTest_SimpleTest_Test :: TestBody () /home/pandasheep.yue/nebula-2.0/nebula-storage/src/storage/test/AddVerticesTest.cpp:50
# 2 0x3f85994 in void testing :: internal :: HandleSehExceptionsInMethodIfSupported <testing :: Test, void> (testing :: Test *, void (testing :: Test :: *) (), char const *) (/ home / pandasheep. yue / nebula-2.0 / nebula-storage / build / src / storage / test / _build / add_vertices_test + 0x3f85994)
# 3 0x3f807b1 in void testing :: internal :: HandleExceptionsInMethodIfSupported <testing :: Test, void> (testing :: Test *, void (testing :: Test :: *) (), char const *) (/ home / pandasheep. yue / nebula-2.0 / nebula-storage / build / src / storage / test / _build / add_vertices_test + 0x3f807b1)
# 4 0x3f66303 in testing :: Test :: Run () (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f66303)
# 5 0x3f66b7f in testing :: TestInfo :: Run () (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f66b7f)
# 6 0x3f671d0 in testing :: TestCase :: Run () (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f671d0)
# 7 0x3f6dd01 in testing :: internal :: UnitTestImpl :: RunAllTests () (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f6dd01)
# 8 0x3f869ab in bool testing :: internal :: HandleSehExceptionsInMethodIfSupported <testing :: internal :: UnitTestImpl, bool> (testing :: internal :: UnitTestImpl *, bool (testing :: internal :: UnitTestImpl :: *) (), char const *) (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f869ab)
# 9 0x3f814bf in bool testing :: internal :: HandleExceptionsInMethodIfSupported <testing :: internal :: UnitTestImpl, bool> (testing :: internal :: UnitTestImpl *, bool (testing :: internal :: UnitTestImpl :: *) (), char const *) (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f814bf)
# 10 0x3f6ca07 in testing :: UnitTest :: Run () (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x3f6ca07)
# 11 0x2139a85 in RUN_ALL_TESTS () (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x2139a85)
# 12 0x2138446 in main /home/pandasheep.yue/nebula-2.0/nebula-storage/src/storage/test/AddVerticesTest.cpp:117
# 13 0x7f416002ef42 in __libc_start_main (/usr/lib64/libc.so.6+0x23f42)
# 14 0x212bd3d in _start (/home/pandasheep.yue/nebula-2.0/nebula-storage/build/src/storage/test/_build/add_vertices_test+0x212bd3d)
Address 0x7f415c7f1660 is located in stack of thread T0 at offset 32 in frame
# 0 0x213826f in nebula :: storage :: AddVerticesTest_SimpleTest_Test :: TestBody () /home/pandasheep.yue/nebula-2.0/nebula-storage/src/storage/test/AddVerticesTest.cpp:24
This frame has 1 object (s):
(32, 40) 'p1' (line 47) <== Memory access at offset 32 is inside this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
(longjmp and C ++ exceptions * are * supported)
SUMMARY: AddressSanitizer: bad-free (/usr/lib64/libasan.so.5+0x111105) in operator delete (void *, unsigned long)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.