From 6759955c95442571a0eb0cf88872b5010c60aad4 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 30 Mar 2018 16:13:53 -0700 Subject: Fixed resource bag retrieval infinite recursion. An app was crashing because in an attempt to retrieve layout attribute/style data, the app infinitely recursed because its parent was set to itself. This change checks if the resource bag parent and child have the same ids, and if so, attempts to find the resource in this bag alone rather than attempting to also look in parent bags. Bug: 74493983 Test: Manual testing of Fitbit app Change-Id: Iea37533a0676bd51b72c9bb235adec9bd04f2ccc (cherry picked from commit ac04095ba91f262c9167985a8024607763d8cacc) --- libs/androidfw/AssetManager2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/androidfw/AssetManager2.cpp') diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index d9f1293183b7..5460b3b4c914 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -596,7 +596,7 @@ const ResolvedBag* AssetManager2::GetBag(uint32_t resid) { const ResTable_map* const map_entry_end = map_entry + dtohl(map->count); uint32_t parent_resid = dtohl(map->parent.ident); - if (parent_resid == 0) { + if (parent_resid == 0 || parent_resid == resid) { // There is no parent, meaning there is nothing to inherit and we can do a simple // copy of the entries in the map. const size_t entry_count = map_entry_end - map_entry; -- cgit v1.2.3-59-g8ed1b