summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2019-08-20 11:13:58 -0700
committerPeter Collingbourne <pcc@google.com>2019-08-20 12:10:46 -0700
commit323e8c616e12f98eb12b39b486aafe988dba202d (patch)
tree789318a70be1a4b5a1b057a7d75f228b0ea79c2e
parent82e347bd4e0afa7ab3895c197cc36242cf169db1 (diff)
Fix out-of-bounds read in ApiList::Dump.
In this loop i ranges from DomainApi::kMin to DomainApi:kMax, while API names in kDomainApiNames are stored at indexes starting from zero, so we need to subtract DomainApi::kMin before indexing into kDomainApiNames. Found by running CTS under HWASAN with the new global instrumentation support. Bug: 139749928 Change-Id: Ib35c4494e7652cfaf84e07ff362210d67a50fba2
-rw-r--r--libartbase/base/hiddenapi_flags.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libartbase/base/hiddenapi_flags.h b/libartbase/base/hiddenapi_flags.h
index 93510632de..59e17a8d90 100644
--- a/libartbase/base/hiddenapi_flags.h
+++ b/libartbase/base/hiddenapi_flags.h
@@ -297,7 +297,7 @@ class ApiList {
} else {
os << ",";
}
- os << kDomainApiNames[i];
+ os << kDomainApiNames[i - helper::ToUint(DomainApi::kMin)];
}
}