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

java.io.File.isInvalid() is racy

    Details

    • Subcomponent:
    • Resolved In Build:
      b11

      Backports

        Description

            final boolean isInvalid() {
                if (status == null) {
                    status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
                                                               : PathStatus.INVALID;
                }
                return status == PathStatus.INVALID;
            }
        If the reads to "status" are reordered and another thread writes to "status", the return value can be wrong.
        Reading "status" to a local variable fixes the issue.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  aeubanks Arthur Eubanks
                  Reporter:
                  aeubanks Arthur Eubanks
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: