RFR [XS]: 8235489: handle return values of sscanf calls in hotspot

Kim Barrett kim.barrett at oracle.com
Mon Dec 9 20:30:43 UTC 2019


> On Dec 9, 2019, at 6:22 AM, Baesken, Matthias <matthias.baesken at sap.com> wrote:
> 
> Hi Kim,  new webrev :
> 
> http://cr.openjdk.java.net/~mbaesken/webrevs/8235489.2/
> 
> 
> regarding the initialization of "name"  - this is indeed for   lines  without  a name entry -  those lines exist  in /proc/self/maps .
> I adjusted the initialization following your recommendation ( handle  matches == 6).
> 
> I also changed the unadorned "%s to one with an int-stringsize-parameter .

------------------------------------------------------------------------------
src/hotspot/os/linux/os_linux.cpp
2084       char name[4097]; // was PATH_MAX + 1

Please stay with the original, using PATH_MAX + 1.  I'm assuming this
change was so in the string parsing argument you could use "%4096s" to
limit the amount of data read into name.  That can still be done with
the size of name being based on PATH_MAX by using a variable field
width for the string conversion, e.g. "%*s" with an argument of
PATH_MAX for the ("*") field width, before the name argument.

------------------------------------------------------------------------------



More information about the hotspot-dev mailing list