From 5b0f1be0a23011416697efaa7e9c050e466c44f5 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Mon, 27 Jul 2015 16:53:14 -0700 Subject: AAPT: Fix printing of resource configurations Print out proper, copied configuration. We add fields to ResTable_config and if we don't copy and fill in defaults when reading old configurations, we end up with garbage values. This can potentially cause a crash as well. Bug:22773426 Change-Id: I64f5ebe73ee72453bcdad3a19e48f8e7ad58e9c2 --- libs/androidfw/ResourceTypes.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index a95db9f..62aabb1 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -6758,7 +6758,13 @@ void ResTable::print(bool inclValues) const printf(" NON-INTEGER ResTable_type ADDRESS: %p\n", type); continue; } - String8 configStr = type->config.toString(); + + // Always copy the config, as fields get added and we need to + // set the defaults. + ResTable_config thisConfig; + thisConfig.copyFromDtoH(type->config); + + String8 configStr = thisConfig.toString(); printf(" config %s:\n", configStr.size() > 0 ? configStr.string() : "(default)"); size_t entryCount = dtohl(type->entryCount); -- cgit v1.1