Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-06-01 Thread Mandy Chung
On 5/29/20 1:03 PM, Mandy Chung wrote: CSR: https://bugs.openjdk.java.net/browse/JDK-8246108 As CSR is approved,  I went ahead and pushed this patch: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8245432/webrev.03/ This version has fixed the range check issue Johannes caught and also added

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-31 Thread Mandy Chung
On 5/29/20 4:31 PM, Johannes Kuhn wrote: Thanks. Noted that readInt can read outside of the byte array when it is shorter than 4 bytes, throwing an ArrayIndexOutOfBoundsException. Same applies for readUnsignedShort. Test cases for malformedClassFiles: new byte[3], new byte[] {0xCA, 0xFE, 0

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-30 Thread David Holmes
On 30/05/2020 6:03 am, Mandy Chung wrote: On 5/28/20 9:18 PM, David Holmes wrote: On 29/05/2020 1:52 pm, Mandy Chung wrote: On 5/28/20 5:44 PM, David Holmes wrote: This is to validate the given version.  The runtime will check if preview feature is enabled when such class file is loaded. I

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-29 Thread Johannes Kuhn
Thanks. Noted that readInt can read outside of the byte array when it is shorter than 4 bytes, throwing an ArrayIndexOutOfBoundsException. Same applies for readUnsignedShort. Test cases for malformedClassFiles: new byte[3], new byte[] {0xCA, 0xFE, 0xBA, 0xBE, 0x00} - Johannes On 29-May-20

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-29 Thread Mandy Chung
On 5/28/20 9:18 PM, David Holmes wrote: On 29/05/2020 1:52 pm, Mandy Chung wrote: On 5/28/20 5:44 PM, David Holmes wrote: This is to validate the given version.  The runtime will check if preview feature is enabled when such class file is loaded. I will make a comment to make it clear.

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-29 Thread Mandy Chung
On 5/29/20 11:29 AM, Alan Bateman wrote: I went through webrev.02 and the only issue is the magic is read as a u2 when it should be u4, otherwise looks good. Thanks.  Updated in place: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8245432/webrev.02/index.html Mandy

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-29 Thread Mandy Chung
It's fixed.  Thanks Mandy On 5/28/20 4:35 PM, Johannes Kuhn wrote: Hi, just noticed a small thing: The magic is 4 bytes, but readUnsignedShort reads two bytes. - Johannes On 28-May-20 19:25, Mandy Chung wrote: On 5/28/20 6:55 AM, Alan Bateman wrote: On 28/05/2020 05:13, Mandy Chung wrote:

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-29 Thread Alan Bateman
On 29/05/2020 04:52, Mandy Chung wrote: On 5/28/20 5:44 PM, David Holmes wrote: This is to validate the given version.  The runtime will check if preview feature is enabled when such class file is loaded.   I will make a comment to make it clear. Okay but I thought the intent here was to

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread David Holmes
À: "mandy chung" , "core-libs-dev" , "Remi Forax" Envoyé: Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version On 26/05/2020 22:46,

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Mandy Chung
SM. Rémi - Mail original - De: "Alan Bateman" À: "mandy chung" , "core-libs-dev" , "Remi Forax" Envoyé: Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes ar

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Johannes Kuhn
Hi, just noticed a small thing: The magic is 4 bytes, but readUnsignedShort reads two bytes. - Johannes On 28-May-20 19:25, Mandy Chung wrote: On 5/28/20 6:55 AM, Alan Bateman wrote: On 28/05/2020 05:13, Mandy Chung wrote: Updated webrev: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/82

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread David Holmes
Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version On 26/05/2020 22:46, Mandy Chung wrote: Lookup::defineHiddenClass currently throws IAE by ASM i

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Alan Bateman
On 28/05/2020 18:25, Mandy Chung wrote: : The runtime will ensure if --enable-preview is set if a class file with minor is loaded.   I will prefer to keep VM::isSupportedClassFileVersion to validate the given major/minor version.  At runtime, it will fail when such class file is loaded if pr

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Mandy Chung
émi - Mail original - De: "Alan Bateman" À: "mandy chung" , "core-libs-dev" , "Remi Forax" Envoyé: Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given b

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Mandy Chung
On 5/28/20 6:55 AM, Alan Bateman wrote: On 28/05/2020 05:13, Mandy Chung wrote: Updated webrev: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8245432/webrev.01/ I modify this patch to check the class file version and throws CFE if unsupported before creating ClassReader.  This also fixes

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Alan Bateman
On 28/05/2020 05:13, Mandy Chung wrote: Updated webrev: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8245432/webrev.01/ I modify this patch to check the class file version and throws CFE if unsupported before creating ClassReader.  This also fixes JDK-8245061 that it reads the value of `th

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread David Holmes
rittle than catching the IAE thrown by ASM. Rémi - Mail original - De: "Alan Bateman" À: "mandy chung" , "core-libs-dev" , "Remi Forax" Envoyé: Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw Unsupporte

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-27 Thread Mandy Chung
On 5/27/20 12:24 AM, David Holmes wrote: Hi Mandy, On 27/05/2020 7:46 am, Mandy Chung wrote: Lookup::defineHiddenClass currently throws IAE by ASM if the given bytes are of unsupported class file version.  The implementation should catch and throw UnsupportedClassVersionError instead. webr

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-27 Thread Mandy Chung
t;Remi Forax" Envoyé: Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version On 26/05/2020 22:46, Mandy Chung wrote: Lookup::defineHiddenClass currently

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-27 Thread Mandy Chung
- De: "Alan Bateman" À: "mandy chung" , "core-libs-dev" , "Remi Forax" Envoyé: Mercredi 27 Mai 2020 18:16:33 Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-27 Thread forax
Rémi - Mail original - > De: "Alan Bateman" > À: "mandy chung" , "core-libs-dev" > , "Remi Forax" > > Envoyé: Mercredi 27 Mai 2020 18:16:33 > Objet: Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw > UnsupportedClassVers

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-27 Thread Alan Bateman
On 26/05/2020 22:46, Mandy Chung wrote: Lookup::defineHiddenClass currently throws IAE by ASM if the given bytes are of unsupported class file version.  The implementation should catch and throw UnsupportedClassVersionError instead. webrev: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-27 Thread David Holmes
Hi Mandy, On 27/05/2020 7:46 am, Mandy Chung wrote: Lookup::defineHiddenClass currently throws IAE by ASM if the given bytes are of unsupported class file version.  The implementation should catch and throw UnsupportedClassVersionError instead. webrev: http://cr.openjdk.java.net/~mchung/jdk15

RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-26 Thread Mandy Chung
Lookup::defineHiddenClass currently throws IAE by ASM if the given bytes are of unsupported class file version.  The implementation should catch and throw UnsupportedClassVersionError instead. webrev: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8245432/webrev.00/ This patch also includes