diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2019-04-15 16:47:58 -0700 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2019-04-16 12:00:30 -0700 |
commit | 0c0cedff00534dd9b14306b7c1cdc20ee20efb5e (patch) | |
tree | 588096197b33d8c760f46e1b04038f4828c0fd64 | |
parent | 488693532998d5e08f68b58b235b7d6dcd3df1fb (diff) |
Check value in dump before printing
For applications that remove the names of resources from the string
pool, check that the attribute has a name before attempting to print it.
Test: manual
Bug: 130553900
Change-Id: I05e5d59f01b2c02c8a024d06fd896074d6bf465b
-rw-r--r-- | tools/aapt2/Debug.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp index 98324850f3f5..3da22b4fb9fa 100644 --- a/tools/aapt2/Debug.cpp +++ b/tools/aapt2/Debug.cpp @@ -129,12 +129,20 @@ class ValueBodyPrinter : public ConstValueVisitor { constexpr uint32_t kMask = android::ResTable_map::TYPE_ENUM | android::ResTable_map::TYPE_FLAGS; if (attr->type_mask & kMask) { for (const auto& symbol : attr->symbols) { - printer_->Print(symbol.symbol.name.value().entry); - if (symbol.symbol.id) { - printer_->Print("("); + if (symbol.symbol.name) { + printer_->Print(symbol.symbol.name.value().entry); + + if (symbol.symbol.id) { + printer_->Print("("); + printer_->Print(symbol.symbol.id.value().to_string()); + printer_->Print(")"); + } + } else if (symbol.symbol.id) { printer_->Print(symbol.symbol.id.value().to_string()); - printer_->Print(")"); + } else { + printer_->Print("???"); } + printer_->Println(StringPrintf("=0x%08x", symbol.value)); } } |