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

(1.1) Unhand bug in native method

XMLWordPrintable

    • generic
    • generic

      For the JDK 116 release on the OpenVMS platform running on DIGITAL's
      hardware, DIGITAL has changed, the following JDK 116 source file
      in the shared part of the JDK.

      A potential bug footprint occurs, i.e. an unhand followed by a memory operation that can provoke GC followed by a use of the unhanded pointer;

      src/share/java/lang/io.c
      * @(#)io.c 1.55 98/07/01^G

      Added called to unhand directly before use of thisptr:
       i.e. dataptr = unhand(data)->body


      diff -c -r JDK116/src/share/java/lang/io.c sun_JDK116/src/share/java/lang/io.c
      *** JDK116/src/share/java/lang/io.c Fri Feb 27 21:38:24 1998
      --- sun_JDK116/src/share/java/lang/io.c Thu Apr 16 13:49:46 1998
      ***************
      *** 348,355 ****
            }
        
            while (len > 0) {
      - /* JLR: Second time through loop, GC might trash dataptr. */
      - dataptr = unhand(data)->body;
              n = sysWriteFD(fdptr, dataptr + off, len);
              if (n == -1) {
                  SignalError(0, IO_EXCEPTION, "write error");
      --- 348,353 ----
      ***************
      *** 538,547 ****
            }
        
            while (len > 0) {
      - /* JLR: Paranoia: ptrs might get GC'd on second pass through loop */
      - thisptr = unhand(this);
      - fdptr = unhand(thisptr->fd);
      - dataptr = unhand(data)->body;
              n = sysWriteFD(fdptr, dataptr + off, len);
              if (n == -1) {
                  SignalError(0, IO_EXCEPTION, "write error");
      --- 536,541 ----

            Unassigned Unassigned
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: