bool normalize_path(constchar* path, std::string* normalized_path) { // Input should be an absolute path if (path[0] != '/') {
DL_WARN("normalize_path - invalid input: \"%s\", the input path should be absolute", path); returnfalse;
}
const size_t len = strlen(path) + 1; char buf[len];
constchar* const path = normalized_path.c_str();
LD_DEBUG(any, "Trying zip file open from path \"%s\" -> normalized \"%s\"", input_path, path);
// Treat an '!/' separator inside a path as the separator between the name // of the zip file on disk and the subdirectory to search within it. // For example, if path is "foo.zip!/bar/bas/x.so", then we search for // "bar/bas/x.so" within "foo.zip". constchar* const separator = strstr(path, kZipFileSeparator); if (separator == nullptr) { returnfalse;
}
char buf[512]; if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) {
DL_WARN("ignoring very long library path: %s", path); returnfalse;
}
std::string resolve_path(const std::string& path) { char resolved_path[PATH_MAX]; constchar* original_path = path.c_str(); if (realpath(original_path, resolved_path) != nullptr) { struct stat s; if (stat(resolved_path, &s) == -1) {
DL_WARN("Warning: cannot stat file \"%s\": %m (ignoring)", resolved_path); return"";
} if (!S_ISDIR(s.st_mode)) {
DL_WARN("Warning: \"%s\" is not a directory (ignoring)", resolved_path); return"";
} return resolved_path;
} else {
std::string normalized_path; if (!normalize_path(original_path, &normalized_path)) {
DL_WARN("Warning: unable to normalize \"%s\" (ignoring)", original_path); return"";
}
std::string zip_path;
std::string entry_path; if (parse_zip_path(normalized_path.c_str(), &zip_path, &entry_path)) { if (realpath(zip_path.c_str(), resolved_path) == nullptr) {
DL_WARN("Warning: unable to resolve \"%s\": %m (ignoring)", zip_path.c_str()); return"";
}
return std::string(resolved_path) + kZipFileSeparator + entry_path;
} else { struct stat s; if (stat(normalized_path.c_str(), &s) == 0 && S_ISDIR(s.st_mode)) { // Path is not a zip path, but an existing directory. Then add it // although we failed to resolve it. b/119656753 return normalized_path;
}
}
} return"";
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.