Hello, probably I should add the info that the fix is needed in jdk9 as well , not only jdk10 .
Without the fix jdk9/10 show this error when executing a small example jar : /myjdk9/images/jdk/lib/jexec /java_test/hellojar/helloworld.jar invalid file (bad magic number): Exec format error with the fix : jdk/lib/jexec /java_test/hellojar/helloworld.jar Hello world from a jar file And btw I really wonder - is jexec still needed in future jdk's like jdk10 ? Seems it is not used much . Best regards, Matthias From: Baesken, Matthias Sent: Mittwoch, 22. Februar 2017 18:16 To: core-libs-dev@openjdk.java.net Cc: Langer, Christoph <christoph.lan...@sap.com>; Erik Joelsson (erik.joels...@oracle.com) <erik.joels...@oracle.com> Subject: RFR [XS] : 8175000 : jexec fails to execute simple helloworld.jar Hello , when looking into the jexec build I noticed that execution of a simple helloworld.jar with jexec does not work any more. I did a little patch for this which adjusted the addition done with CR 8156478: 3 Buffer overrun defect groups in jexec.c<https://javapartner.oracle.com/mproxy/repository/technology/java2/jdk9/jdk/rev/4f96129b45ee> . Could I have a review ( just a diff this time is provided because of infrastructure issues) for it ? Thanks, Matthias Bug : https://bugs.openjdk.java.net/browse/JDK-8175000 Diff for jdk10 : # HG changeset patch # User mbaesken # Date 1487782485 -3600 # Wed Feb 22 17:54:45 2017 +0100 # Node ID 93d55a711f3b1c3f282e6889c24d13f16d4a4548 # Parent 884872263accabd4ab68d005abd4e5393144aa4f 8175000: jexec fails to execute simple helloworld.jar diff --git a/src/java.base/unix/native/launcher/jexec.c b/src/java.base/unix/native/launcher/jexec.c --- a/src/java.base/unix/native/launcher/jexec.c +++ b/src/java.base/unix/native/launcher/jexec.c @@ -331,8 +331,9 @@ off_t end = start + xlen; if (end <= count) { - end -= 4; // make sure there are 4 bytes to read at start - while (start < end) { + // make sure there are 4 bytes to read at start + end -= 3; + while ((start < end) && (start < count-3)) { off_t xhid = SH(buf, start); off_t xdlen = SH(buf, start + 2);