[clang] 8e2c192 - clang/Modules: Add missing diagnostics for malformed AST files
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 11 16:01:09 PST 2019
Author: Duncan P. N. Exon Smith
Date: 2019-11-11T16:00:47-08:00
New Revision: 8e2c192e2af8c760152ba3b28e774dbb1548e4aa
URL: https://github.com/llvm/llvm-project/commit/8e2c192e2af8c760152ba3b28e774dbb1548e4aa
DIFF: https://github.com/llvm/llvm-project/commit/8e2c192e2af8c760152ba3b28e774dbb1548e4aa.diff
LOG: 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.
Added:
Modified:
clang/lib/Serialization/ASTReader.cpp
Removed:
################################################################################
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index a5cd9e9f83e9..b780335233b6 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);
More information about the cfe-commits
mailing list