diff options
author | Dimitry Ivanov <dimitry@google.com> | 2016-05-09 10:55:50 -0700 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2016-05-09 12:21:55 -0700 |
commit | cf9892b6d1b0138bdf2341aaa0670c43af27cb85 (patch) | |
tree | 3c6fed38a2454bd68921a581c85e26768eed516a /libnativeloader/native_loader.cpp | |
parent | 08660a811e078d3a6ce950a340a1b9071cfd7e8d (diff) |
nativeloader: Fix the case of search_path == null
When user creates custom classloader which does not extend
BaseDexClassLoader the librarySearchPath gets set to null
by java.lang.Runtime.doLoad().
This patch makes nativeloader correctly handle it.
Bug: http://b/28659864
Change-Id: I1b61c6bc952984d7c49775a9178fc3270948e62a
(cherry picked from commit 8a0425b86acd4f20ef68ef350ac32e1c5057c558)
Diffstat (limited to 'libnativeloader/native_loader.cpp')
-rw-r--r-- | libnativeloader/native_loader.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 7abc2c336..5c1db5b48 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -56,7 +56,12 @@ class LibraryNamespaces { jstring java_library_path, jstring java_permitted_path, int32_t target_sdk_version) { - ScopedUtfChars library_path(env, java_library_path); + std::string library_path; // empty string by default. + + if (java_library_path != nullptr) { + ScopedUtfChars library_path_utf_chars(env, java_library_path); + library_path = library_path_utf_chars.c_str(); + } std::string permitted_path; if (java_permitted_path != nullptr) { |