Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp

Issue 684163002: Library loading fallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final update for review feedback Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/android_crazy_linker/src/src/crazy_linker_library_list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp
index 444b62a4ca64328189ff6504e5fa6d5e1d5452b0..3b64b307619424d282e01ce2ef71397bcc67b281 100644
--- a/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp
@@ -5,6 +5,7 @@
#include "crazy_linker_library_list.h"
#include <assert.h>
+#include <crazy_linker.h>
#include <dlfcn.h>
#include "crazy_linker_debug.h"
@@ -20,9 +21,6 @@ namespace crazy {
namespace {
-// Maximum filename length of a file in a zip file.
-const size_t kMaxFilenameInZip = 256;
-
// Page size for alignment in a zip file.
const size_t kZipAlignmentPageSize = 4096;
static_assert(kZipAlignmentPageSize % PAGE_SIZE == 0,
@@ -401,24 +399,28 @@ LibraryView* LibraryList::LoadLibrary(const char* lib_name,
#error "Unsupported target abi"
#endif
+String LibraryList::GetLibraryFilePathInZipFile(const char* lib_name) {
+ String path;
+ path.Reserve(kMaxFilePathLengthInZip);
+ path = "lib/";
+ path += CURRENT_ABI;
+ path += "/crazy.";
+ path += lib_name;
+ return path;
+}
+
int LibraryList::FindAlignedLibraryInZipFile(
const char* zip_file_path,
const char* lib_name,
Error* error) {
- String fullname;
- fullname.Reserve(kMaxFilenameInZip);
- fullname = "lib/";
- fullname += CURRENT_ABI;
- fullname += "/crazy.";
- fullname += lib_name;
-
- if (fullname.size() + 1 > kMaxFilenameInZip) {
+ String path = GetLibraryFilePathInZipFile(lib_name);
+ if (path.size() >= kMaxFilePathLengthInZip) {
error->Format("Filename too long for a file in a zip file %s\n",
- fullname.c_str());
+ path.c_str());
return CRAZY_OFFSET_FAILED;
}
- int offset = FindStartOffsetOfFileInZipFile(zip_file_path, fullname.c_str());
+ int offset = FindStartOffsetOfFileInZipFile(zip_file_path, path.c_str());
if (offset == CRAZY_OFFSET_FAILED) {
return CRAZY_OFFSET_FAILED;
}
« no previous file with comments | « third_party/android_crazy_linker/src/src/crazy_linker_library_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698