summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiziano Müller <dev-zero@gentoo.org>2009-08-07 05:37:03 +0000
committerTiziano Müller <dev-zero@gentoo.org>2009-08-07 05:37:03 +0000
commitf0e8705c0f215a5f53e195aeb3b8b6eac9e48013 (patch)
tree919b0e04ba0e7cfccfe91ffc06c2ef40533841ae /dev-libs/xerces-c
parentstable x86, security bug 280590 (diff)
downloadhistorical-f0e8705c0f215a5f53e195aeb3b8b6eac9e48013.tar.gz
historical-f0e8705c0f215a5f53e195aeb3b8b6eac9e48013.tar.bz2
historical-f0e8705c0f215a5f53e195aeb3b8b6eac9e48013.zip
Added patch for CVE-2009-2625 (bug #280613).
Package-Manager: portage-2.2_rc36/cvs/Linux x86_64
Diffstat (limited to 'dev-libs/xerces-c')
-rw-r--r--dev-libs/xerces-c/ChangeLog8
-rw-r--r--dev-libs/xerces-c/Manifest4
-rw-r--r--dev-libs/xerces-c/files/xerces-c-3.0.1-CVE-2009-2625.patch649
-rw-r--r--dev-libs/xerces-c/xerces-c-3.0.1-r1.ebuild89
4 files changed, 748 insertions, 2 deletions
diff --git a/dev-libs/xerces-c/ChangeLog b/dev-libs/xerces-c/ChangeLog
index 2818f44c75af..4f7d06ddcd85 100644
--- a/dev-libs/xerces-c/ChangeLog
+++ b/dev-libs/xerces-c/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for dev-libs/xerces-c
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/xerces-c/ChangeLog,v 1.79 2009/03/02 08:58:57 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/xerces-c/ChangeLog,v 1.80 2009/08/07 05:37:03 dev-zero Exp $
+
+*xerces-c-3.0.1-r1 (07 Aug 2009)
+
+ 07 Aug 2009; Tiziano Müller <dev-zero@gentoo.org>
+ +xerces-c-3.0.1-r1.ebuild, +files/xerces-c-3.0.1-CVE-2009-2625.patch:
+ Added patch for CVE-2009-2625 (bug #280613).
*xerces-c-3.0.1 (02 Mar 2009)
diff --git a/dev-libs/xerces-c/Manifest b/dev-libs/xerces-c/Manifest
index 77cc6242b08d..a9f843560719 100644
--- a/dev-libs/xerces-c/Manifest
+++ b/dev-libs/xerces-c/Manifest
@@ -4,6 +4,7 @@ AUX xerces-c-2.7.0-multilib.patch 3267 RMD160 2fbd2a9400ff4bf962c04667b825945eca
AUX xerces-c-2.8.0-64bit_cast.patch 727 RMD160 b0cc302d30c95f324e474a802ad4f14eba57e1c9 SHA1 218b982f7b9c6cf086bd17a392b2c036769677a4 SHA256 74cc58e469980c32a1161941b69a9e18362e983687a5979ee4ab1fd1d83699d8
AUX xerces-c-2.8.0-IconvGNUTransService.cpp.patch 324 RMD160 055a3e565da152b8183284af44a4da8861c851a1 SHA1 47efb106fc25b7a56511aab06462ccd26c9ad246 SHA256 8e37758f88ef3ab2bce31fc9573822b40591250755dcaddf85e53ce9e52b1759
AUX xerces-c-2.8.0-icu_ressource_fix.patch 1924 RMD160 f994c6003136494672aceaa072ceb7ccc74f7a42 SHA1 fac51469c89c279fed291067ed1d2c1cab660616 SHA256 88b8ee0ec3fd5974c4ccf8d599d91932a1e15ef84927331f42fbce46f7f51046
+AUX xerces-c-3.0.1-CVE-2009-2625.patch 26741 RMD160 926f7b57cf5976696b98835cc48a6a4f42209b2b SHA1 8227519677d0bd58094e0c7645f46b635e931caa SHA256 da95a0890c307ca3998c60dd65db675522570c460d010c8962996193b444f87a
AUX xqilla-xercesc_content_type.patch 65395 RMD160 8335d58163b813d4e7ba94b406039e1f6d51e164 SHA1 0a30ee2b6d1192aaeb7c1b7159cec3a1a9588b12 SHA256 60978dd2db53197c8166c92918045c33fe395e440948219e8db11e8e98b0149e
AUX xqilla-xercesc_regex.patch 46363 RMD160 152e646713a6cc9a75033d94b749d84ad319e143 SHA1 30bc755ebff51e069f9b7a3778e96549859708f7 SHA256 3c2ad2a107ff8b27ab719571b60cb786c4967c2796343928d9ecd3adb3e87d24
DIST xerces-c-3.0.0.tar.gz 4605395 RMD160 92353ec5ec90f292dfc92bf9a9232ddb70977c70 SHA1 3119b26dc749354d645c6f5bae29e1940372a6dc SHA256 ae2ff10d4bb12b120568d781f03056d7b4d1e2742858d3b7bb535a4a791f92a1
@@ -14,6 +15,7 @@ EBUILD xerces-c-2.7.0-r1.ebuild 1501 RMD160 1003b096fcea0bfeb57e9f8069ef56df7807
EBUILD xerces-c-2.8.0-r1.ebuild 4642 RMD160 d8058817eb9deccd296c28d7ce7ad26df1308358 SHA1 05eefb2a9b3fc1c0546e0b0738e5e4ca41ef43ee SHA256 0f2d68da5eace07a620fe44d122b981b9fb9c41284ea7b37930081970b7ff9ab
EBUILD xerces-c-3.0.0-r1.ebuild 2368 RMD160 833bc04b122e8653c06924752cf66576cba1d598 SHA1 6c56885d2db92222865c7d5e47b31ed11c6dc172 SHA256 15268ec558c9e9b0bbf34af7633bdd7b45db7328b5c994cabcb174c8b2abde7a
EBUILD xerces-c-3.0.0.ebuild 2467 RMD160 4e9d9a7cdbbd794c2c72b516d1c6d7a93ede497c SHA1 543c1d76da1fe86b5723722aaaf208810342dd4e SHA256 f8056de840c1ef8cc63deffa2bf8a183e0ec36ddc15090c5a9d4b023d855e7ba
+EBUILD xerces-c-3.0.1-r1.ebuild 2333 RMD160 2fddd50280dd7972e8b132cd4fba2744aa02e166 SHA1 1d41f41e9bc240d3935cfaf674429478b4489d33 SHA256 d0a0ffd00abc9f3f43498db3f2294613aaaccbfab67254ce171a6451b4e5789a
EBUILD xerces-c-3.0.1.ebuild 2282 RMD160 bf4b92fd1bd6f3f7dafd1f1529539b9e231d4e93 SHA1 ed1c47fa20e1edc0690470e4bf4a888056c3ad41 SHA256 49ee5a37bf7c653a9c29ff01c81887f650b6e349237f86020f8a21728985fd0b
-MISC ChangeLog 12703 RMD160 270117ebfc20bdc3b5d8c558f2354fa331a36123 SHA1 1950157c40319f744bfb0b0a883c9e9ccd415de5 SHA256 ddd770a7f9ce0db5d2fc2bd7a542fd37733966cf693e50eaa9a4fe5154404204
+MISC ChangeLog 12910 RMD160 408a691838fa990e5faad169860c362cbba0e595 SHA1 5b65f6770dec7cc7eae1d26bffbafdaa2b29886b SHA256 bd9070e3c21ec5e6d82fdd0196cae9119f34fab973c3b26d92da3edff62f89b6
MISC metadata.xml 990 RMD160 6d3971925c8a3cc216d6fd906e280bf5191ee6df SHA1 74ca30d03cbdfa15b5c3d9b103acb103ed21973f SHA256 a2260c914227a67006832de9657613f5337edfe071ca47b56f3fc37794563855
diff --git a/dev-libs/xerces-c/files/xerces-c-3.0.1-CVE-2009-2625.patch b/dev-libs/xerces-c/files/xerces-c-3.0.1-CVE-2009-2625.patch
new file mode 100644
index 000000000000..d3ab8ed32722
--- /dev/null
+++ b/dev-libs/xerces-c/files/xerces-c-3.0.1-CVE-2009-2625.patch
@@ -0,0 +1,649 @@
+--- xerces/c/trunk/src/xercesc/validators/DTD/DTDScanner.cpp 2009/06/03 17:26:39 781487
++++ xerces/c/trunk/src/xercesc/validators/DTD/DTDScanner.cpp 2009/06/03 17:27:07 781488
+@@ -27,7 +27,9 @@
+ #include <xercesc/util/FlagJanitor.hpp>
+ #include <xercesc/util/Janitor.hpp>
+ #include <xercesc/util/XMLUniDefs.hpp>
++#include <xercesc/util/ValueStackOf.hpp>
+ #include <xercesc/util/UnexpectedEOFException.hpp>
++#include <xercesc/util/OutOfMemoryException.hpp>
+ #include <xercesc/sax/InputSource.hpp>
+ #include <xercesc/framework/XMLDocumentHandler.hpp>
+ #include <xercesc/framework/XMLEntityHandler.hpp>
+@@ -39,7 +41,6 @@
+ #include <xercesc/validators/DTD/DTDEntityDecl.hpp>
+ #include <xercesc/validators/DTD/DocTypeHandler.hpp>
+ #include <xercesc/validators/DTD/DTDScanner.hpp>
+-#include <xercesc/util/OutOfMemoryException.hpp>
+
+ XERCES_CPP_NAMESPACE_BEGIN
+
+@@ -1041,338 +1042,354 @@
+ // Check for a PE ref here, but don't require spaces
+ checkForPERef(false, true);
+
+- // We have to check entity nesting here
+- XMLSize_t curReader;
+-
++ ValueStackOf<XMLSize_t>* arrNestedDecl=NULL;
+ //
+ // We know that the caller just saw an opening parenthesis, so we need
+- // to parse until we hit the end of it, recursing for other nested
+- // parentheses we see.
++ // to parse until we hit the end of it; if we find several parenthesis,
++ // store them in an array to be processed later.
+ //
+ // We have to check for one up front, since it could be something like
+ // (((a)*)) etc...
+ //
+ ContentSpecNode* curNode = 0;
+- if (fReaderMgr->skippedChar(chOpenParen))
++ while(fReaderMgr->skippedChar(chOpenParen))
+ {
+- curReader = fReaderMgr->getCurrentReaderNum();
++ // to check entity nesting
++ const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum();
++ if(arrNestedDecl==NULL)
++ arrNestedDecl=new (fMemoryManager) ValueStackOf<XMLSize_t>(5, fMemoryManager);
++ arrNestedDecl->push(curReader);
+
+- // Lets call ourself and get back the resulting node
+- curNode = scanChildren(elemDecl, bufToUse);
++ // Check for a PE ref here, but don't require spaces
++ checkForPERef(false, true);
++ }
+
+- // If that failed, no need to go further, return failure
+- if (!curNode)
+- return 0;
++ // We must find a leaf node here, either standalone or nested in the parenthesis
++ if (!fReaderMgr->getName(bufToUse))
++ {
++ fScanner->emitError(XMLErrs::ExpectedElementName);
++ return 0;
++ }
+
+- if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always)
+- fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE);
++ //
++ // Create a leaf node for it. If we can find the element id for
++ // this element, then use it. Else, we have to fault in an element
++ // decl, marked as created because of being in a content model.
++ //
++ XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bufToUse.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
++ if (!decl)
++ {
++ decl = new (fGrammarPoolMemoryManager) DTDElementDecl
++ (
++ bufToUse.getRawBuffer()
++ , fEmptyNamespaceId
++ , DTDElementDecl::Any
++ , fGrammarPoolMemoryManager
++ );
++ decl->setCreateReason(XMLElementDecl::InContentModel);
++ decl->setExternalElemDeclaration(isReadingExternalEntity());
++ fDTDGrammar->putElemDecl(decl);
+ }
+- else
++ curNode = new (fGrammarPoolMemoryManager) ContentSpecNode
++ (
++ decl->getElementName()
++ , fGrammarPoolMemoryManager
++ );
++
++ // Check for a PE ref here, but don't require spaces
++ const bool gotSpaces = checkForPERef(false, true);
++
++ // Check for a repetition character after the leaf
++ XMLCh repCh = fReaderMgr->peekNextChar();
++ ContentSpecNode* tmpNode = makeRepNode(repCh, curNode, fGrammarPoolMemoryManager);
++ if (tmpNode != curNode)
+ {
+- // Not a nested paren, so it must be a leaf node
+- if (!fReaderMgr->getName(bufToUse))
++ if (gotSpaces)
+ {
+- fScanner->emitError(XMLErrs::ExpectedElementName);
+- return 0;
++ if (fScanner->emitErrorWillThrowException(XMLErrs::UnexpectedWhitespace))
++ {
++ delete tmpNode;
++ }
++ fScanner->emitError(XMLErrs::UnexpectedWhitespace);
+ }
++ fReaderMgr->getNextChar();
++ curNode = tmpNode;
++ }
++
++ while(arrNestedDecl==NULL || !arrNestedDecl->empty())
++ {
++ // Check for a PE ref here, but don't require spaces
++ checkForPERef(false, true);
+
+ //
+- // Create a leaf node for it. If we can find the element id for
+- // this element, then use it. Else, we have to fault in an element
+- // decl, marked as created because of being in a content model.
++ // Ok, the next character tells us what kind of content this particular
++ // model this particular parentesized section is. Its either a choice if
++ // we see ',', a sequence if we see '|', or a single leaf node if we see
++ // a closing paren.
++ //
++ const XMLCh opCh = fReaderMgr->peekNextChar();
++
++ if ((opCh != chComma)
++ && (opCh != chPipe)
++ && (opCh != chCloseParen))
++ {
++ // Not a legal char, so delete our node and return failure
++ delete curNode;
++ fScanner->emitError(XMLErrs::ExpectedSeqChoiceLeaf);
++ return 0;
++ }
++
+ //
+- XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bufToUse.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
+- if (!decl)
++ // Create the head node of the correct type. We need this to remember
++ // the top of the local tree. If it was a single subexpr, then just
++ // set the head node to the current node. For the others, we'll build
++ // the tree off the second child as we move across.
++ //
++ ContentSpecNode* headNode = 0;
++ ContentSpecNode::NodeTypes curType = ContentSpecNode::UnknownType;
++ if (opCh == chComma)
+ {
+- decl = new (fGrammarPoolMemoryManager) DTDElementDecl
++ curType = ContentSpecNode::Sequence;
++ headNode = new (fGrammarPoolMemoryManager) ContentSpecNode
+ (
+- bufToUse.getRawBuffer()
+- , fEmptyNamespaceId
+- , DTDElementDecl::Any
++ curType
++ , curNode
++ , 0
++ , true
++ , true
+ , fGrammarPoolMemoryManager
+ );
+- decl->setCreateReason(XMLElementDecl::InContentModel);
+- decl->setExternalElemDeclaration(isReadingExternalEntity());
+- fDTDGrammar->putElemDecl(decl);
++ curNode = headNode;
+ }
+- curNode = new (fGrammarPoolMemoryManager) ContentSpecNode
+- (
+- decl->getElementName()
+- , fGrammarPoolMemoryManager
+- );
+-
+- // Check for a PE ref here, but don't require spaces
+- const bool gotSpaces = checkForPERef(false, true);
+-
+- // Check for a repetition character after the leaf
+- const XMLCh repCh = fReaderMgr->peekNextChar();
+- ContentSpecNode* tmpNode = makeRepNode(repCh, curNode, fGrammarPoolMemoryManager);
+- if (tmpNode != curNode)
++ else if (opCh == chPipe)
+ {
+- if (gotSpaces)
+- {
+- if (fScanner->emitErrorWillThrowException(XMLErrs::UnexpectedWhitespace))
+- {
+- delete tmpNode;
+- }
+- fScanner->emitError(XMLErrs::UnexpectedWhitespace);
+- }
++ curType = ContentSpecNode::Choice;
++ headNode = new (fGrammarPoolMemoryManager) ContentSpecNode
++ (
++ curType
++ , curNode
++ , 0
++ , true
++ , true
++ , fGrammarPoolMemoryManager
++ );
++ curNode = headNode;
++ }
++ else
++ {
++ headNode = curNode;
+ fReaderMgr->getNextChar();
+- curNode = tmpNode;
+ }
+- }
+
+- // Check for a PE ref here, but don't require spaces
+- checkForPERef(false, true);
+-
+- //
+- // Ok, the next character tells us what kind of content this particular
+- // model this particular parentesized section is. Its either a choice if
+- // we see ',', a sequence if we see '|', or a single leaf node if we see
+- // a closing paren.
+- //
+- const XMLCh opCh = fReaderMgr->peekNextChar();
+-
+- if ((opCh != chComma)
+- && (opCh != chPipe)
+- && (opCh != chCloseParen))
+- {
+- // Not a legal char, so delete our node and return failure
+- delete curNode;
+- fScanner->emitError(XMLErrs::ExpectedSeqChoiceLeaf);
+- return 0;
+- }
+-
+- //
+- // Create the head node of the correct type. We need this to remember
+- // the top of the local tree. If it was a single subexpr, then just
+- // set the head node to the current node. For the others, we'll build
+- // the tree off the second child as we move across.
+- //
+- ContentSpecNode* headNode = 0;
+- ContentSpecNode::NodeTypes curType = ContentSpecNode::UnknownType;
+- if (opCh == chComma)
+- {
+- curType = ContentSpecNode::Sequence;
+- headNode = new (fGrammarPoolMemoryManager) ContentSpecNode
+- (
+- curType
+- , curNode
+- , 0
+- , true
+- , true
+- , fGrammarPoolMemoryManager
+- );
+- curNode = headNode;
+- }
+- else if (opCh == chPipe)
+- {
+- curType = ContentSpecNode::Choice;
+- headNode = new (fGrammarPoolMemoryManager) ContentSpecNode
+- (
+- curType
+- , curNode
+- , 0
+- , true
+- , true
+- , fGrammarPoolMemoryManager
+- );
+- curNode = headNode;
+- }
+- else
+- {
+- headNode = curNode;
+- fReaderMgr->getNextChar();
+- }
+-
+- //
+- // If it was a sequence or choice, we just loop until we get to the
+- // end of our section, adding each new leaf or sub expression to the
+- // right child of the current node, and making that new node the current
+- // node.
+- //
+- if ((opCh == chComma) || (opCh == chPipe))
+- {
+- ContentSpecNode* lastNode = 0;
+- while (true)
++ //
++ // If it was a sequence or choice, we just loop until we get to the
++ // end of our section, adding each new leaf or sub expression to the
++ // right child of the current node, and making that new node the current
++ // node.
++ //
++ if ((opCh == chComma) || (opCh == chPipe))
+ {
+- //
+- // The next thing must either be another | or , character followed
+- // by another leaf or subexpression, or a closing parenthesis, or a
+- // PE ref.
+- //
+- if (fReaderMgr->lookingAtChar(chPercent))
+- {
+- checkForPERef(false, true);
+- }
+- else if (fReaderMgr->skippedSpace())
+- {
+- // Just skip whitespace
+- fReaderMgr->skipPastSpaces();
+- }
+- else if (fReaderMgr->skippedChar(chCloseParen))
++ ContentSpecNode* lastNode = 0;
++ while (true)
+ {
+ //
+- // We've hit the end of this section, so break out. But, we
+- // need to see if we left a partial sequence of choice node
+- // without a second node. If so, we have to undo that and
+- // put its left child into the right node of the previous
+- // node.
++ // The next thing must either be another | or , character followed
++ // by another leaf or subexpression, or a closing parenthesis, or a
++ // PE ref.
+ //
+- if ((curNode->getType() == ContentSpecNode::Choice)
+- || (curNode->getType() == ContentSpecNode::Sequence))
++ if (fReaderMgr->lookingAtChar(chPercent))
+ {
+- if (!curNode->getSecond())
++ checkForPERef(false, true);
++ }
++ else if (fReaderMgr->skippedSpace())
++ {
++ // Just skip whitespace
++ fReaderMgr->skipPastSpaces();
++ }
++ else if (fReaderMgr->skippedChar(chCloseParen))
++ {
++ //
++ // We've hit the end of this section, so break out. But, we
++ // need to see if we left a partial sequence of choice node
++ // without a second node. If so, we have to undo that and
++ // put its left child into the right node of the previous
++ // node.
++ //
++ if ((curNode->getType() == ContentSpecNode::Choice)
++ || (curNode->getType() == ContentSpecNode::Sequence))
+ {
+- ContentSpecNode* saveFirst = curNode->orphanFirst();
+- lastNode->setSecond(saveFirst);
+- curNode = lastNode;
++ if (!curNode->getSecond())
++ {
++ ContentSpecNode* saveFirst = curNode->orphanFirst();
++ lastNode->setSecond(saveFirst);
++ curNode = lastNode;
++ }
+ }
++ break;
+ }
+- break;
+- }
+- else if (fReaderMgr->skippedChar(opCh))
+- {
+- // Check for a PE ref here, but don't require spaces
+- checkForPERef(false, true);
+-
+- if (fReaderMgr->skippedChar(chOpenParen))
++ else if (fReaderMgr->skippedChar(opCh))
+ {
+- curReader = fReaderMgr->getCurrentReaderNum();
++ // Check for a PE ref here, but don't require spaces
++ checkForPERef(false, true);
+
+- // Recurse to handle this new guy
+- ContentSpecNode* subNode;
+- try {
+- subNode = scanChildren(elemDecl, bufToUse);
+- }
+- catch (const XMLErrs::Codes)
++ if (fReaderMgr->skippedChar(chOpenParen))
+ {
+- delete headNode;
+- throw;
+- }
++ const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum();
+
+- // If it failed, we are done, clean up here and return failure
+- if (!subNode)
+- {
+- delete headNode;
+- return 0;
++ // Recurse to handle this new guy
++ ContentSpecNode* subNode;
++ try {
++ subNode = scanChildren(elemDecl, bufToUse);
++ }
++ catch (const XMLErrs::Codes)
++ {
++ delete headNode;
++ throw;
++ }
++
++ // If it failed, we are done, clean up here and return failure
++ if (!subNode)
++ {
++ delete headNode;
++ return 0;
++ }
++
++ if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always)
++ fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE);
++
++ // Else patch it in and make it the new current
++ ContentSpecNode* newCur = new (fGrammarPoolMemoryManager) ContentSpecNode
++ (
++ curType
++ , subNode
++ , 0
++ , true
++ , true
++ , fGrammarPoolMemoryManager
++ );
++ curNode->setSecond(newCur);
++ lastNode = curNode;
++ curNode = newCur;
+ }
++ else
++ {
++ //
++ // Got to be a leaf node, so get a name. If we cannot get
++ // one, then clean up and get outa here.
++ //
++ if (!fReaderMgr->getName(bufToUse))
++ {
++ delete headNode;
++ fScanner->emitError(XMLErrs::ExpectedElementName);
++ return 0;
++ }
++
++ //
++ // Create a leaf node for it. If we can find the element
++ // id for this element, then use it. Else, we have to
++ // fault in an element decl, marked as created because
++ // of being in a content model.
++ //
++ XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bufToUse.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
++ if (!decl)
++ {
++ decl = new (fGrammarPoolMemoryManager) DTDElementDecl
++ (
++ bufToUse.getRawBuffer()
++ , fEmptyNamespaceId
++ , DTDElementDecl::Any
++ , fGrammarPoolMemoryManager
++ );
++ decl->setCreateReason(XMLElementDecl::InContentModel);
++ decl->setExternalElemDeclaration(isReadingExternalEntity());
++ fDTDGrammar->putElemDecl(decl);
++ }
+
+- if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always)
+- fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE);
++ ContentSpecNode* tmpLeaf = new (fGrammarPoolMemoryManager) ContentSpecNode
++ (
++ decl->getElementName()
++ , fGrammarPoolMemoryManager
++ );
+
+- // Else patch it in and make it the new current
+- ContentSpecNode* newCur = new (fGrammarPoolMemoryManager) ContentSpecNode
+- (
+- curType
+- , subNode
+- , 0
+- , true
+- , true
+- , fGrammarPoolMemoryManager
+- );
+- curNode->setSecond(newCur);
+- lastNode = curNode;
+- curNode = newCur;
++ // Check for a repetition character after the leaf
++ const XMLCh repCh = fReaderMgr->peekNextChar();
++ ContentSpecNode* tmpLeaf2 = makeRepNode(repCh, tmpLeaf, fGrammarPoolMemoryManager);
++ if (tmpLeaf != tmpLeaf2)
++ fReaderMgr->getNextChar();
++
++ //
++ // Create a new sequence or choice node, with the leaf
++ // (or rep surrounding it) we just got as its first node.
++ // Make the new node the second node of the current node,
++ // and then make it the current node.
++ //
++ ContentSpecNode* newCur = new (fGrammarPoolMemoryManager) ContentSpecNode
++ (
++ curType
++ , tmpLeaf2
++ , 0
++ , true
++ , true
++ , fGrammarPoolMemoryManager
++ );
++ curNode->setSecond(newCur);
++ lastNode = curNode;
++ curNode = newCur;
++ }
+ }
+ else
+ {
+- //
+- // Got to be a leaf node, so get a name. If we cannot get
+- // one, then clean up and get outa here.
+- //
+- if (!fReaderMgr->getName(bufToUse))
++ // Cannot be valid
++ delete headNode; // emitError may do a throw so need to clean-up first
++ if (opCh == chComma)
+ {
+- delete headNode;
+- fScanner->emitError(XMLErrs::ExpectedElementName);
+- return 0;
++ fScanner->emitError(XMLErrs::ExpectedChoiceOrCloseParen);
+ }
+-
+- //
+- // Create a leaf node for it. If we can find the element
+- // id for this element, then use it. Else, we have to
+- // fault in an element decl, marked as created because
+- // of being in a content model.
+- //
+- XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bufToUse.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
+- if (!decl)
++ else
+ {
+- decl = new (fGrammarPoolMemoryManager) DTDElementDecl
++ fScanner->emitError
+ (
+- bufToUse.getRawBuffer()
+- , fEmptyNamespaceId
+- , DTDElementDecl::Any
+- , fGrammarPoolMemoryManager
++ XMLErrs::ExpectedSeqOrCloseParen
++ , elemDecl.getFullName()
+ );
+- decl->setCreateReason(XMLElementDecl::InContentModel);
+- decl->setExternalElemDeclaration(isReadingExternalEntity());
+- fDTDGrammar->putElemDecl(decl);
+- }
++ }
++ return 0;
++ }
++ }
++ }
+
+- ContentSpecNode* tmpLeaf = new (fGrammarPoolMemoryManager) ContentSpecNode
+- (
+- decl->getElementName()
+- , fGrammarPoolMemoryManager
+- );
++ //
++ // We saw the terminating parenthesis so lets check for any repetition
++ // character, and create a node for that, making the head node the child
++ // of it.
++ //
++ const XMLCh repCh = fReaderMgr->peekNextChar();
++ curNode = makeRepNode(repCh, headNode, fGrammarPoolMemoryManager);
++ if (curNode != headNode)
++ fReaderMgr->getNextChar();
+
+- // Check for a repetition character after the leaf
+- const XMLCh repCh = fReaderMgr->peekNextChar();
+- ContentSpecNode* tmpLeaf2 = makeRepNode(repCh, tmpLeaf, fGrammarPoolMemoryManager);
+- if (tmpLeaf != tmpLeaf2)
+- fReaderMgr->getNextChar();
++ // prepare for recursion
++ if(arrNestedDecl==NULL)
++ break;
++ else
++ {
++ // If that failed, no need to go further, return failure
++ if (!curNode)
++ return 0;
+
+- //
+- // Create a new sequence or choice node, with the leaf
+- // (or rep surrounding it) we just got as its first node.
+- // Make the new node the second node of the current node,
+- // and then make it the current node.
+- //
+- ContentSpecNode* newCur = new (fGrammarPoolMemoryManager) ContentSpecNode
+- (
+- curType
+- , tmpLeaf2
+- , 0
+- , true
+- , true
+- , fGrammarPoolMemoryManager
+- );
+- curNode->setSecond(newCur);
+- lastNode = curNode;
+- curNode = newCur;
+- }
+- }
+- else
++ const XMLSize_t curReader = arrNestedDecl->pop();
++ if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always)
++ fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE);
++
++ if(arrNestedDecl->empty())
+ {
+- // Cannot be valid
+- delete headNode; // emitError may do a throw so need to clean-up first
+- if (opCh == chComma)
+- {
+- fScanner->emitError(XMLErrs::ExpectedChoiceOrCloseParen);
+- }
+- else
+- {
+- fScanner->emitError
+- (
+- XMLErrs::ExpectedSeqOrCloseParen
+- , elemDecl.getFullName()
+- );
+- }
+- return 0;
++ delete arrNestedDecl;
++ arrNestedDecl=NULL;
+ }
+ }
+ }
+
+- //
+- // We saw the terminating parenthesis so lets check for any repetition
+- // character, and create a node for that, making the head node the child
+- // of it.
+- //
+- XMLCh repCh = fReaderMgr->peekNextChar();
+- ContentSpecNode* retNode = makeRepNode(repCh, headNode, fGrammarPoolMemoryManager);
+- if (retNode != headNode)
+- fReaderMgr->getNextChar();
+-
+- return retNode;
++ return curNode;
+ }
+
+
diff --git a/dev-libs/xerces-c/xerces-c-3.0.1-r1.ebuild b/dev-libs/xerces-c/xerces-c-3.0.1-r1.ebuild
new file mode 100644
index 000000000000..a86075d07565
--- /dev/null
+++ b/dev-libs/xerces-c/xerces-c-3.0.1-r1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/xerces-c/xerces-c-3.0.1-r1.ebuild,v 1.1 2009/08/07 05:37:03 dev-zero Exp $
+
+EAPI="2"
+
+inherit eutils
+
+DESCRIPTION="A validating XML parser written in a portable subset of C++."
+HOMEPAGE="http://xerces.apache.org/xerces-c/"
+SRC_URI="mirror://apache/xerces/c/3/sources/${P}.tar.gz"
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="curl debug doc iconv icu libwww threads elibc_Darwin elibc_FreeBSD"
+
+RDEPEND="icu? ( dev-libs/icu )
+ curl? ( net-misc/curl )
+ libwww? ( net-libs/libwww )
+ virtual/libiconv"
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )"
+
+pkg_setup() {
+ export ICUROOT="/usr"
+
+ if use iconv && use icu ; then
+ ewarn "This package can use iconv or icu for loading messages"
+ ewarn "and transcoding, but not both. ICU will precede."
+ fi
+}
+
+src_prepare() {
+ sed -i \
+ -e 's|$(prefix)/msg|$(DESTDIR)/$(prefix)/share/xerces-c/msg|' \
+ src/xercesc/util/MsgLoaders/MsgCatalog/Makefile.in || die "sed failed"
+
+ epatch "${FILESDIR}/${P}-CVE-2009-2625.patch"
+}
+
+src_configure() {
+ local mloader="inmemory"
+ use iconv && mloader="iconv"
+ use icu && mloader="icu"
+
+ local transcoder="gnuiconv"
+ use elibc_FreeBSD && transcoder="iconv"
+ use elibc_Darwin && transcoder="macosunicodeconverter"
+ use icu && transcoder="icu"
+
+ # 'cfurl' is only available on OSX and 'socket' isn't supposed to work.
+ # But the docs aren't clear about it, so we would need some testing...
+ local netaccessor="socket"
+ use elibc_Darwin && netaccessor="cfurl"
+ use libwww && netaccessor="libwww"
+ use curl && netaccessor="curl"
+
+ econf \
+ $(use_enable debug) \
+ $(use_enable threads) \
+ --enable-msgloader-${mloader} \
+ --enable-netaccessor-${netaccessor} \
+ --enable-transcoder-${transcoder}
+}
+
+src_compile() {
+ default
+
+ if use doc ; then
+ cd "${S}/doc"
+ doxygen || die "making docs failed"
+ fi
+}
+
+src_install () {
+ emake DESTDIR="${D}" install || die "emake failed"
+
+ cd "${S}"
+ doenvd "${FILESDIR}/50xerces-c"
+
+ if use doc; then
+ insinto /usr/share/doc/${PF}
+ rm -rf samples/Makefile* samples/runConfigure samples/src/*/Makefile* samples/.libs
+ doins -r samples
+ dohtml -r doc/html/*
+ fi
+
+ dodoc CREDITS KEYS NOTICE README version.incl
+}