Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1025

XMLPlatformUtils::Initialize sets memory manager before checking whether it's been run already

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Utilities
    • None
    • Operating System: All
      Platform: All
    • 23930

    Description

      Before checking whether it's already been run (by checking it's "init count")
      Initialize sets the global memory manager, thereby potentially changing the
      memory manager during an allocation in another thread, corrupting memory.
      The patch inline below fixes the problem (current CVS, PlatformuUtils.cpp)

      Index: PlatformUtils.cpp
      ===================================================================
      RCS file: /home/cvspublic/xml-xerces/c/src/xercesc/util/PlatformUtils.cpp,v
      retrieving revision 1.11
      diff -w -b -u -p -r1.11 PlatformUtils.cpp
      — PlatformUtils.cpp 27 Aug 2003 16:41:56 -0000 1.11
      +++ PlatformUtils.cpp 20 Oct 2003 10:01:38 -0000
      @@ -236,6 +236,17 @@ void XMLPlatformUtils::Initialize(const
      if (gInitFlag == LONG_MAX)
      return;

      + //
      + // Make sure we haven't already been initialized. Note that this is not
      + // thread safe and is not intended for that. Its more for those COM
      + // like processes that cannot keep up with whether they have initialized
      + // us yet or not.
      + //
      + gInitFlag++;
      +
      + if (gInitFlag > 1)
      + return;
      +
      // Set pluggable memory manager
      if (!fgMemoryManager)

      { @@ -250,17 +261,6 @@ void XMLPlatformUtils::Initialize(const }

      }

      • //
      • // Make sure we haven't already been initialized. Note that this is not
      • // thread safe and is not intended for that. Its more for those COM
      • // like processes that cannot keep up with whether they have initialized
      • // us yet or not.
      • //
      • gInitFlag++;
        -
      • if (gInitFlag > 1)
      • return;
        -
        /***
      • Panic Handler:
        *

      HTH

      rlc

      Attachments

        Activity

          People

            Unassigned Unassigned
            ronald@landheer.com Ronald Landheer-Cieslak
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: