AAPT2: Fix silent failure when ContainerReader fails during Link

Currently in the link step ContainerReader is used to read files but the
reader is not checked for errors prior to the read. This can lead to
silent failure when reading invalid resource files.

Change-Id: I6420699ad30b5b84b0b2c696af8eb5a6cbd4111e
This commit is contained in:
Mohamed Heikal
2018-02-07 15:17:38 -05:00
parent ea8feabec5
commit 1084432e1e

View File

@@ -1446,6 +1446,13 @@ class LinkCommand {
ContainerReaderEntry* entry;
ContainerReader reader(input_stream.get());
if (reader.HadError()) {
context_->GetDiagnostics()->Error(DiagMessage(src)
<< "failed to read file: " << reader.GetError());
return false;
}
while ((entry = reader.Next()) != nullptr) {
if (entry->Type() == ContainerEntryType::kResTable) {
pb::ResourceTable pb_table;