RFR(XS): 8153835: Fix range of flag MaxDirectMemorySize which is parsed at jlong.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Thu Apr 14 10:14:25 UTC 2016


Hi Gerard, 

The code you change is not the problem. The value is passed to Java code,
and java code can't  handle it:

java.lang.NumberFormatException: For input string: "18446744073709551615"
        at java.lang.NumberFormatException.forInputString(java.base/NumberFormatException.java:65)
        at java.lang.Long.parseLong(java.base/Long.java:747)
        at java.lang.Long.parseLong(java.base/Long.java:872)
        at jdk.internal.misc.VM.saveAndRemoveProperties(java.base/VM.java:290)
        at java.lang.System.initPhase1(java.base/System.java:1865)

We could change the flag to jlong / int64_t with a positive range. But I think
size_t is best for a flag giving a memory size.

Best regards,
  Goetz.



> -----Original Message-----
> From: Gerard Ziemski [mailto:gerard.ziemski at oracle.com]
> Sent: Mittwoch, 13. April 2016 18:30
> To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>
> Cc: hotspot-runtime-dev at openjdk.java.net
> Subject: Re: RFR(XS): 8153835: Fix range of flag MaxDirectMemorySize which
> is parsed at jlong.
> 
> hi Goetz,
> 
> How about if we just change the MaxDirectMemorySize type to uint64_t, like
> so:
> 
> http://cr.openjdk.java.net/~gziemski/8153835_rev1/
> 
> 
> cheers
> 
> 
> > On Apr 13, 2016, at 8:25 AM, Lindenmaier, Goetz
> <goetz.lindenmaier at sap.com> wrote:
> >
> > Hi,
> >
> > could someone please have a look at this tiny issue? And sponsor?
> >
> > Thanks,
> >  Goetz.
> >
> >> -----Original Message-----
> >> From: Lindenmaier, Goetz
> >> Sent: Freitag, 8. April 2016 10:53
> >> To: hotspot-runtime-dev at openjdk.java.net
> >> Subject: RFR(XS): 8153835: Fix range of flag MaxDirectMemorySize which
> is
> >> parsed at jlong.
> >>
> >> Hi,
> >>
> >>
> >>
> >> The upper limit of the range for flag MaxDirectMemorySize is
> MAX_SIZE_T.
> >>
> >> The flag is used to set a property that is parsed into a long. Thus, the max
> >>
> >> value on 64-bit platforms is too large.
> >>
> >> Fix: Limit the range to max_jlong, too.
> >>
> >>
> >>
> >> Please review this change. I please need a sponsor.
> >>
> >> http://cr.openjdk.java.net/~goetz/wr16/8153835-MaxDMSz/webrev.01/
> >>
> >>
> >>
> >> Best regards,
> >>
> >>  Goetz.
> >>
> >>
> >>
> >>
> >



More information about the hotspot-runtime-dev mailing list