diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-11-10 11:07:20 -0800 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-11-11 16:00:47 -0800 |
| commit | 8e2c192e2af8c760152ba3b28e774dbb1548e4aa (patch) | |
| tree | b03f3c9eb01c7df35af8fb9ebed0f9f54f5ae9bf | |
| parent | 0b8dfb5762fdc350c5071c9eeffd4f7e4d495e98 (diff) | |
| download | bcm5719-llvm-8e2c192e2af8c760152ba3b28e774dbb1548e4aa.tar.gz bcm5719-llvm-8e2c192e2af8c760152ba3b28e774dbb1548e4aa.zip | |
clang/Modules: Add missing diagnostics for malformed AST files
These were found via an audit. In the case of `ParseLineTable` this is
actually dead code, since parsing the line table always succeeds, but
it's prudent to be defensive since it's possible an assertion there
could be converted to a `true` return in the future.
| -rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index a5cd9e9f83e..b780335233b 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3408,8 +3408,10 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { break; case SOURCE_MANAGER_LINE_TABLE: - if (ParseLineTable(F, Record)) + if (ParseLineTable(F, Record)) { + Error("malformed SOURCE_MANAGER_LINE_TABLE in AST file"); return Failure; + } break; case SOURCE_LOCATION_PRELOADS: { @@ -4771,8 +4773,10 @@ ASTReader::ASTReadResult ASTReader::ReadExtensionBlock(ModuleFile &F) { switch (MaybeRecCode.get()) { case EXTENSION_METADATA: { ModuleFileExtensionMetadata Metadata; - if (parseModuleFileExtensionMetadata(Record, Blob, Metadata)) + if (parseModuleFileExtensionMetadata(Record, Blob, Metadata)) { + Error("malformed EXTENSION_METADATA in AST file"); return Failure; + } // Find a module file extension with this block name. auto Known = ModuleFileExtensions.find(Metadata.BlockName); |

