diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2018-05-10 12:55:40 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2018-05-10 22:49:34 +0100 |
commit | 0d0f3164160e50ddb78022f662c5438fc167f50d (patch) | |
tree | 13bfdad1117db0adfb8b434ff1b8e1589c0c43ea /runtime/base | |
parent | 9d7905fffb9eca8f4fa6f3f3d7d3deb9718e3005 (diff) | |
download | art-0d0f3164160e50ddb78022f662c5438fc167f50d.tar.gz art-0d0f3164160e50ddb78022f662c5438fc167f50d.tar.bz2 art-0d0f3164160e50ddb78022f662c5438fc167f50d.zip |
Handle multidex in LocationIsOnSystemFramework.
bug: 79111915
Test: art_dex_file_loader_test.cc
Change-Id: I507ad98c62b4c589196685d74abdeaf748502a61
Diffstat (limited to 'runtime/base')
-rw-r--r-- | runtime/base/file_utils.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc index 7921985b15..537216c198 100644 --- a/runtime/base/file_utils.cc +++ b/runtime/base/file_utils.cc @@ -261,12 +261,12 @@ std::string ReplaceFileExtension(const std::string& filename, const std::string& } } -bool LocationIsOnSystem(const char* location) { - UniqueCPtr<const char[]> path(realpath(location, nullptr)); - return path != nullptr && android::base::StartsWith(path.get(), GetAndroidRoot().c_str()); +bool LocationIsOnSystem(const char* path) { + UniqueCPtr<const char[]> full_path(realpath(path, nullptr)); + return path != nullptr && android::base::StartsWith(full_path.get(), GetAndroidRoot().c_str()); } -bool LocationIsOnSystemFramework(const char* location) { +bool LocationIsOnSystemFramework(const char* full_path) { std::string error_msg; std::string root_path = GetAndroidRootSafe(&error_msg); if (root_path.empty()) { @@ -275,12 +275,7 @@ bool LocationIsOnSystemFramework(const char* location) { return false; } std::string framework_path = root_path + "/framework/"; - - // Warning: Bionic implementation of realpath() allocates > 12KB on the stack. - // Do not run this code on a small stack, e.g. in signal handler. - UniqueCPtr<const char[]> path(realpath(location, nullptr)); - return path != nullptr && - android::base::StartsWith(path.get(), framework_path.c_str()); + return android::base::StartsWith(full_path, framework_path); } } // namespace art |