Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8332400

isspace argument should be a valid unsigned char

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 23
    • hotspot
    • b03

      We call isspace in several places both in hotspot and in the JDK.

      POSIX states:

      ```
      The c argument is an int, the value of which the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF. If the argument has any other value, the behavior is undefined.
      ```

      Check all call sites whether we have undefined behavior. If input is char, at the very least we should cast it to unsigned.

      Possibly we should add range checks, too, and maybe provide a new wrapper in os::is_space (this only works for hotspot internal usage)




      [1] https://pubs.opengroup.org/onlinepubs/007904975/functions/isspace.html

            rtoyonaga Robert Toyonaga
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: