From 03783217a0a82d698eced567d3e72a1a6dfd6a81 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 26 May 2017 00:15:15 +0000 Subject: [PATCH] [llvm-pdbdump] Don't crash when displaying padding. We have a lot of complicated logic to determine where padding is in a record, and the debug info doesn't always provide enough information to figure it out with laser precision. In this case we were putting the padding in the wrong place causing an out of bounds access on a BitVector. Right now we decide that any trailing padding of a child type will be truncated during record layout, but this is only true insofar as the class still is sized properly to end on an alignment boundary, which the algorithm doesn't yet know about. For now, just don't crash, even though we display padding twice in this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303946 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-pdbdump/PrettyClassLayoutGraphicalDumper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/llvm-pdbdump/PrettyClassLayoutGraphicalDumper.cpp b/tools/llvm-pdbdump/PrettyClassLayoutGraphicalDumper.cpp index 16cec82f718..d1147267962 100644 --- a/tools/llvm-pdbdump/PrettyClassLayoutGraphicalDumper.cpp +++ b/tools/llvm-pdbdump/PrettyClassLayoutGraphicalDumper.cpp @@ -80,7 +80,8 @@ bool PrettyClassLayoutGraphicalDumper::start(const UDTLayoutBase &Layout) { if (Item->getLayoutSize() > 0) { uint32_t Prev = RelativeOffset + Item->getLayoutSize() - 1; - NextPaddingByte = UseMap.find_next_unset(Prev); + if (Prev < UseMap.size()) + NextPaddingByte = UseMap.find_next_unset(Prev); } } -- 2.40.0