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

an unhand followed by memory op can provoke GC followed by a use of unhanded ptr

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      For the JDK 116 release on the OpenVMS platform running on DIGITAL's
      hardware, DIGITAL has changed, the following JDK 116 source files
      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/filesystem.c
      * @(#)filesystem.c 1.49 98/07/01

      Added called to unhand directly before use of thisptr:
       i.e. thisptr = unhand(this);

      diff -c -r JDK116/src/share/java/lang/filesystem.c
      sun_JDK116/src/share/java/lang/filesystem.c
      *** JDK116/src/share/java/lang/filesystem.c Thu May 21 02:03:44 1998
      --- sun_JDK116/src/share/java/lang/filesystem.c Thu Apr 16 13:49:48 1998


      ***************
      *** 299,307 ****
                      narr = (HArrayOfString *) ArrayAlloc(T_CLASS, maxlen <<= 1);
                      if (narr == NULL) {
                          char utfPath[128];
      - /* Dir ops may trigger GC, trashing ptr; reunhand -- jlr */
      - /* follow DU lead MPH __VMS */
      - thisptr = unhand(this);
                          javaString2UTF(thisptr->path, utfPath, sizeof(utfPath));
                          sysCloseDir(dir);
                          SignalError(0, JAVAPKG "OutOfMemoryError", utfPath);
      --- 297,302 ----
      ***************
      *** 329,337 ****
            narr = (HArrayOfString *)ArrayAlloc(T_CLASS, len);
            if (narr == NULL) {
                char utfPath[128];
      - /* follow digital Unix lead MPH __VMS */
      - /* May not need to reunhand here, but it's cheap insurance-- jlr */
      - thisptr = unhand(this);
              javaString2UTF(thisptr->path, utfPath, sizeof(utfPath));
              sysCloseDir(dir);
              SignalError(0, JAVAPKG "OutOfMemoryError", utfPath);

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: