DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23930>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23930 XMLPlatformUtils::Initialize sets memory manager before checking whether it's been run already Summary: XMLPlatformUtils::Initialize sets memory manager before checking whether it's been run already Product: Xerces-C++ Version: 2.3.0 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Utilities AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
