[llvm-bugs] [Bug 46900] New: MCContext untyped bump allocator not suitable for MCInst.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 29 17:01:37 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46900
Bug ID: 46900
Summary: MCContext untyped bump allocator not suitable for
MCInst.
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hgreving at google.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 23789
--> https://bugs.llvm.org/attachment.cgi?id=23789&action=edit
Small reproducer
Allocating MCInst with MCContext's overloaded 'new' can lead to a memory leak.
The reason is that MCInst contains a SmallVector<MCOperand, 8>. The SmallVector
is POD only for <= 8 operands. The default untyped bump pointer allocator of
MCContext does not delete the MCInst.
Small reproducer:
./llvm-project/install/bin/clang++ -O0 -g3 -c -o mcinst.o
`./llvm-project/install/bin/llvm-config --cxxflags` -fsanitize=address
mcinst.cc
./llvm-project/install/bin/clang++ mcinst.o
`./llvm-project/install/bin/llvm-config --ldflags --libs` -lpthread -ltinfo
-ldl -lz -fsanitize=address -o mcinst
ASAN_SYMBOLIZER_PATH=./llvm-project/install/bin/llvm-symbolizer ./test
Thanks to Marcello Maggioni and Thomas Raoux for helping to find this.
Suggested patch:
https://reviews.llvm.org/D84896
--
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/20200730/d9580832/attachment-0001.html>
More information about the llvm-bugs
mailing list