[PATCH] D70057: clang/Modules: Add missing diagnostics for malformed AST files
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 10 11:44:24 PST 2019
dexonsmith created this revision.
dexonsmith added reviewers: aprantl, bruno, Bigcheese.
Herald added a subscriber: ributzka.
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.
https://reviews.llvm.org/D70057
Files:
clang/lib/Serialization/ASTReader.cpp
Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -3408,8 +3408,10 @@
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: {
@@ -4780,8 +4782,10 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70057.228615.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191110/8223cdd4/attachment-0001.bin>
More information about the cfe-commits
mailing list