Projects
Mega:24.03:SP1:Everything
openjdk-1.8.0
_service:tar_scm:print-fd-and-file-path-when-a-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:print-fd-and-file-path-when-a-zip-invalid-loc-header.patch of Package openjdk-1.8.0
diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c index 3dbd2ba62..ff59c5ecc 100644 --- a/jdk/src/share/native/java/util/zip/zip_util.c +++ b/jdk/src/share/native/java/util/zip/zip_util.c @@ -81,6 +81,20 @@ static jint INITIAL_META_COUNT = 2; /* initial number of entries in meta name #ifdef LINUX #define ZIP_INVALID_LOC_HEADER_EXIT "ZIP_INVALID_LOC_HEADER_EXIT" +void printFdInfo(jzfile *zip) { + int fd = zip->zfd; + char fdPath[100]; + char filePath[PATH_MAX + 1]; + sprintf(fdPath, "/proc/self/fd/%d", fd); + int len = readlink(fdPath, filePath, PATH_MAX); + if (len < 0) { + printf("[LOC-ERROR] Could not find fd : %d\n", fd); + return; + } + filePath[len] = '\0'; + printf("[LOC-ERROR] LOC check failed, zfd : %d , zfd file : %s\n", zip->zfd, filePath); +} + char *getExitFlag() { static char *process_exit_flag = NULL; static jboolean is_initialized = JNI_FALSE; @@ -1339,8 +1353,8 @@ ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry) if (GETSIG(loc) != LOCSIG) { zip->msg = "invalid LOC header (bad signature)"; printf("[LOC-ERROR] LOC check failed, %s\n", zip->msg); - printf("[LOC-ERROR] LOC check failed for jar: %s, class: %s, LOC: %08lx, pos:%ld\n", - zip->name, entry->name, GETSIG(loc), (-(entry->pos))); + printf("[LOC-ERROR] LOC check failed for jar: %s, class: %s, LOCSIG: %08lx, expected LOCSIG: %08lx, " + "pos:%ld\n", zip->name, entry->name, GETSIG(loc), LOCSIG, (-(entry->pos))); unsigned int *temp = (unsigned int *) loc; printf("[LOC-ERROR] LOC check failed, readVal: %08x %08x %08x %08x %08x %08x %08x %02x %02x\n", *temp, *(temp + 1), *(temp + 2), *(temp + 3), *(temp + 4), @@ -1349,6 +1363,9 @@ ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry) #ifdef LINUX #define ZIP_INVALID_LOC_HEADER_EXIT_ONLY "1" #define ZIP_INVALID_LOC_HEADER_EXIT_CODE_DUMP "2" + // print fd info + printFdInfo(zip); + /* * The meaning of the exit flag is as follows: * 1: exit (126) -- 2.12.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2