Request for review 6924920: Class Data Sharing limit on the java version string can create failures: JVM Ident field too long
Peter Levart
peter.levart at gmail.com
Fri Nov 9 08:34:09 PST 2012
On 11/08/2012 07:23 PM, harold seigel wrote:
> Please review the following change.
>
> Summary: The problem was fixed by truncating the JVM ident to
> JVM_IDENT_MAX and calling method fail_continue() instead of fail_stop().
>
> Open webrev at http://cr.openjdk.java.net/~hseigel/bug_6924920/
> <http://cr.openjdk.java.net/%7Ehseigel/bug_6924920/>
>
> Bug link at http://bugs.sun.com/view_bug.do?bug_id=6924920
>
> The changes were tested with JPRT, JCK, and by using a version string
> that exceeded 256 characters.
>
> Thanks, Harold
Hi Harold,
99 if (strlen(vm_version) < (JVM_IDENT_MAX-1)) {
100 strcpy(_header._jvm_ident, vm_version);
101 } else {
102 strncpy(_header._jvm_ident, vm_version, JVM_IDENT_MAX-1);
103 _header._jvm_ident[JVM_IDENT_MAX-1] = 0; // Null terminate.
104 fail_continue("JVM Ident field for shared archive is too long"
105 " - truncated to <%s>", _header._jvm_ident);
106 }
Couldn't the condition:
if (strlen(vm_version) < (JVM_IDENT_MAX-1))
be writen as:
if (strlen(vm_version) < JVM_IDENT_MAX)
...and allow one more char into the __jvm__indent ?
JVM_IDENT_MAX is the allocated space for __jvm__indent and strlen returns the length without the terminating '\0'.
Regards, Peter
More information about the hotspot-runtime-dev
mailing list