[CodeView] Call llvm::codeview::visitMemberRecordStream with the deserialized CVType...
authorZequan Wu <zequanwu@google.com>
Thu, 30 Jun 2022 00:09:40 +0000 (17:09 -0700)
committerZequan Wu <zequanwu@google.com>
Thu, 30 Jun 2022 00:18:56 +0000 (17:18 -0700)
commitbd2044c108655dc6409e2c724349219d3971b151
tree7655d638b9e4176b2e3ed660fb4c1aa64f7b6b58
parentc09e533374139f17a040040ffdb03ea20fac2736
[CodeView] Call llvm::codeview::visitMemberRecordStream with the deserialized CVType whose kind is FieldListRecord.

llvm::codeview::visitMemberRecordStream expects to receive an array ref that's FieldListRecord's Data not a CVType's data which has 4 more bytes preceeding. The first 2 bytes indicate the size of the FieldListRecord, and following 2 bytes is always 0x1203. Inside llvm::codeview::visitMemberRecordStream, it iterates to the data to check if first two bytes matching some type record kinds. If the size coincidentally matches one type kind, it will start parsing from there and causing crash.
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp