diff options
author | Zachary Turner <zturner@google.com> | 2017-06-06 23:54:23 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-06 23:54:23 +0000 |
commit | 1bfb9f47af8b80d81c48eec71ee3865e3f1b2a68 (patch) | |
tree | 5208899c5b3b8d27382828f490113f297e4f6a00 /llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp | |
parent | 492c29f03daed2787f88db579d415de06bf6fbe0 (diff) | |
download | bcm5719-llvm-1bfb9f47af8b80d81c48eec71ee3865e3f1b2a68.tar.gz bcm5719-llvm-1bfb9f47af8b80d81c48eec71ee3865e3f1b2a68.zip |
Fix uninitialized read.
llvm-svn: 304846
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp index 22c2ef31bd7..cd69ad3cfc2 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp @@ -38,12 +38,12 @@ template <> struct BinaryItemTraits<CVSymbol> { static uint32_t calculateDiSymbolStreamSize(uint32_t SymbolByteSize, uint32_t C13Size) { - uint32_t Size = sizeof(uint32_t); // Signature - Size += SymbolByteSize; // Symbol Data - Size += 0; // TODO: Layout.C11Bytes - Size += C13Size; // C13 Debug Info Size - Size += sizeof(uint32_t); // GlobalRefs substream size (always 0) - Size += 0; // GlobalRefs substream bytes + uint32_t Size = sizeof(uint32_t); // Signature + Size += alignTo(SymbolByteSize, 4); // Symbol Data + Size += 0; // TODO: Layout.C11Bytes + Size += C13Size; // C13 Debug Info Size + Size += sizeof(uint32_t); // GlobalRefs substream size (always 0) + Size += 0; // GlobalRefs substream bytes return Size; } @@ -156,6 +156,8 @@ Error DbiModuleDescriptorBuilder::commit(BinaryStreamWriter &ModiWriter, BinaryStreamRef RecordsRef(Records); if (auto EC = SymbolWriter.writeStreamRef(RecordsRef)) return EC; + if (auto EC = SymbolWriter.padToAlignment(4)) + return EC; // TODO: Write C11 Line data assert(SymbolWriter.getOffset() % alignOf(CodeViewContainer::Pdb) == 0 && "Invalid debug section alignment!"); |