RFR: 8282395: URL.openConnection can throw IOOBE [v3]
    Daniel Fuchs 
    dfuchs at openjdk.org
       
    Wed Sep 28 11:19:23 UTC 2022
    
    
  
On Fri, 16 Sep 2022 06:15:01 GMT, KIRIYAMA Takuya <duke at openjdk.org> wrote:
>> I fixed sun.net.www.ParseUtil.decode().
>> 
>> ParseUtil.decode() always tries to decode after parsing '%', so if '%' is located at the end of the String, IndexOutOfBoundsException is thrown. Also, if '%' is shown after decodable string and following string is not decodable (e.g: "%25%s%G1"), ParseUtil.decode() throws IllegalArgumentException.
>> 
>> But URL standard says below (https://url.spec.whatwg.org/#percent-decode).
>> 
>> 
>> Otherwise, if byte is 0x25 (%) and the next two bytes after byte in input are not in the ranges 
>> 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F), and 0x61 (a) to 0x66 (f), all inclusive, append byte to output.
>> 
>> 
>> So, there should be used isEscaped() to judge to decode.
>> 
>> Would you please review this fix?
>
> KIRIYAMA Takuya has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8282395: URL.openConnection can throw IOOBE
Changes requested by dfuchs (Reviewer).
src/java.base/share/classes/sun/net/www/protocol/ftp/Handler.java line 66:
> 64:             connection = new FtpURLConnection(u, p);
> 65:         } catch (IllegalArgumentException e) {
> 66:             throw new MalformedURLException(e.getMessage());
I'd suggest keeping the IllegalArgumentException as the root cause of the MUE for better diagnosability. Otherwise LGTM.
-------------
PR: https://git.openjdk.org/jdk/pull/8155
    
    
More information about the net-dev
mailing list