https://bugs.llvm.org/show_bug.cgi?id=45144
Bug ID: 45144
Summary: __builtin_dump_struct buffer overrun with types it
doesn't handle
Product: clang
Version: 9.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: ndkrem...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
The following program:
#include <cstdio>
struct Foo {
short a[1];
};
int main() {
Foo f = {2};
__builtin_dump_struct(&f, &std::printf);
}
prints out garbage data from clang's memory:
struct Foo {
short [1] a : 0x315b2074726f0002
}
The "0002" on the end is the valid data, the rest is presumably whatever
happened to be in the compiler's memory afterwards.
A similar thing happens with any field type that __builtin_dump_struct doesn't
understand - it prints out 8 bytes (or maybe 4 bytes on a 32-bit system) of
data, regardless of the actual size of the field.
Reproduced on clang 9.0.0 and trunk. Didn't seem to occur on 7.0.0 and 8.0.0
but that could have just been getting lucky that the extra bytes displayed were
all 0.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs