Skip to content

Commit 5b0f1be

Browse files
author
Adam Lesinski
committed
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
1 parent 71bfb27 commit 5b0f1be

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

libs/androidfw/ResourceTypes.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6758,7 +6758,13 @@ void ResTable::print(bool inclValues) const
67586758
printf(" NON-INTEGER ResTable_type ADDRESS: %p\n", type);
67596759
continue;
67606760
}
6761-
String8 configStr = type->config.toString();
6761+
6762+
// Always copy the config, as fields get added and we need to
6763+
// set the defaults.
6764+
ResTable_config thisConfig;
6765+
thisConfig.copyFromDtoH(type->config);
6766+
6767+
String8 configStr = thisConfig.toString();
67626768
printf(" config %s:\n", configStr.size() > 0
67636769
? configStr.string() : "(default)");
67646770
size_t entryCount = dtohl(type->entryCount);

0 commit comments

Comments
 (0)