8170663: Fix minor issues in corelib and servicabilty coding

Co-authored-by: David CARLIER <devnexen@gmail.com>
Reviewed-by: dsamersoff, dholmes
This commit is contained in:
Goetz Lindenmaier 2016-12-02 15:02:10 +01:00
parent 213a2bc257
commit 7172c36a8d
5 changed files with 29 additions and 27 deletions

View File

@ -181,7 +181,7 @@ void ImageDecompressor::decompress_resource(u1* compressed, u1* uncompressed,
}
} while (has_header);
memcpy(uncompressed, decompressed_resource, (size_t) uncompressed_size);
delete decompressed_resource;
delete[] decompressed_resource;
}
// Zip decompressor

View File

@ -444,13 +444,13 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
return;
}
#else
JLI_MemFree(newargv);
return;
JLI_MemFree(newargv);
return;
#endif /* SETENV_REQUIRED */
} else { /* do the same speculatively or exit */
} else { /* do the same speculatively or exit */
JLI_ReportErrorMessage(JRE_ERROR2, wanted);
exit(1);
}
}
#ifdef SETENV_REQUIRED
if (mustsetenv) {
/*
@ -516,14 +516,14 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
/* runpath contains current effective LD_LIBRARY_PATH setting */
jvmpath = JLI_StringDup(jvmpath);
char *new_jvmpath = JLI_StringDup(jvmpath);
new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
2 * JLI_StrLen(jrepath) + 2 * JLI_StrLen(arch) +
#ifdef AIX
/* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
JLI_StrLen(jrepath) + JLI_StrLen(arch) + JLI_StrLen("/lib//jli:") +
#endif
JLI_StrLen(jvmpath) + 52;
JLI_StrLen(new_jvmpath) + 52;
new_runpath = JLI_MemAlloc(new_runpath_size);
newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
@ -533,7 +533,7 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
*/
{
/* remove the name of the .so from the JVM path */
lastslash = JLI_StrRChr(jvmpath, '/');
lastslash = JLI_StrRChr(new_jvmpath, '/');
if (lastslash)
*lastslash = '\0';
@ -544,7 +544,7 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
"%s/lib/%s/jli:" /* Needed on AIX because ld doesn't support $ORIGIN. */
#endif
"%s/../lib/%s",
jvmpath,
new_jvmpath,
jrepath, arch,
#ifdef AIX
jrepath, arch,
@ -552,6 +552,7 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
jrepath, arch
);
JLI_MemFree(new_jvmpath);
/*
* Check to make sure that the prefix of the current path is the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -249,16 +249,19 @@ private jboolean isValid(void);
int lastLn = 0;
int sti;
if (cnt < 0) {
return;
}
loadDebugInfo(env, clazz);
if (!isValid()) {
return; /* no SDE or not SourceMap - return unchanged */
}
sti = stratumTableIndex(globalDefaultStratumId);
if (sti == baseStratumIndex) {
if (sti == baseStratumIndex || sti < 0) {
return; /* Java stratum - return unchanged */
}
LOG_MISC(("SDE is re-ordering the line table"));
for (; cnt-->0; ++fromEntry) {
for (; cnt-- > 0; ++fromEntry) {
int jplsLine = fromEntry->line_number;
int lti = stiLineTableIndex(sti, jplsLine);
if (lti >= 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -196,18 +196,10 @@ dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value)
} else if (cmd == SO_LINGER) {
struct linger arg;
arg.l_onoff = on;
if(on) {
arg.l_linger = (unsigned short)value.i;
if(setsockopt(fd, SOL_SOCKET, SO_LINGER,
(char*)&arg, sizeof(arg)) < 0) {
return SYS_ERR;
}
} else {
if (setsockopt(fd, SOL_SOCKET, SO_LINGER,
(char*)&arg, sizeof(arg)) < 0) {
return SYS_ERR;
}
arg.l_linger = (on) ? (unsigned short)value.i : 0;
if (setsockopt(fd, SOL_SOCKET, SO_LINGER,
(char*)&arg, sizeof(arg)) < 0) {
return SYS_ERR;
}
} else if (cmd == SO_SNDBUF) {
jint buflen = value.i;

View File

@ -2293,10 +2293,15 @@ void unpacker::read_ics() {
number.set(null,0);
name = n.slice(dollar2+1, nlen);
}
if (number.ptr == null)
if (number.ptr == null) {
if (dollar1 < 0) {
abort();
return;
}
pkgOuter = n.slice(0, dollar1);
else
} else {
pkgOuter.set(null,0);
}
PRINTCR((5,"=> %s$ 0%s $%s",
pkgOuter.string(), number.string(), name.string()));
@ -4197,6 +4202,7 @@ void unpacker::write_bc_ops() {
// Note that insnMap has one entry for all these bytes.
--wp; // not really part of the code
int size = bc_escsize.getInt();
if (size < 0) { assert(false); continue; }
ensure_put_space(size);
for (int j = 0; j < size; j++)
putu1_fast(bc_escbyte.getByte());