You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2002/03/14 23:09:08 UTC
cvs commit: xml-xerces/c/src/xercesc/idom IDCharacterDataImpl.cpp
tng 02/03/14 14:09:07
Modified: c/src/xercesc/idom IDCharacterDataImpl.cpp
Log:
IDOM Fix: Issue IDOM_DOMException::INDEX_SIZE_ERR if count or offset is negative.
Revision Changes Path
1.2 +8 -4 xml-xerces/c/src/xercesc/idom/IDCharacterDataImpl.cpp
Index: IDCharacterDataImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/idom/IDCharacterDataImpl.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IDCharacterDataImpl.cpp 1 Feb 2002 22:21:53 -0000 1.1
+++ IDCharacterDataImpl.cpp 14 Mar 2002 22:09:07 -0000 1.2
@@ -55,7 +55,7 @@
*/
/*
- * $Id: IDCharacterDataImpl.cpp,v 1.1 2002/02/01 22:21:53 peiyongz Exp $
+ * $Id: IDCharacterDataImpl.cpp,v 1.2 2002/03/14 22:09:07 tng Exp $
*/
#include "IDCharacterDataImpl.hpp"
@@ -135,7 +135,7 @@
//
unsigned int len = XMLString::stringLen(this->fData);
- if (offset >= len)
+ if (offset >= len || offset < 0 || count < 0)
throw IDOM_DOMException(IDOM_DOMException::INDEX_SIZE_ERR, 0);
@@ -160,7 +160,7 @@
newString = temp;
XMLString::copyNString(newString, fData, offset);
- XMLString::copyString(newString+offset, fData+offset+len);
+ XMLString::copyString(newString+offset, fData+offset+count);
fData = ((IDDocumentImpl *)node->getOwnerDocument())->getPooledString(newString);
@@ -213,7 +213,7 @@
//
unsigned int len = XMLString::stringLen(this->fData);
- if (offset >= len)
+ if (offset >= len || offset < 0)
throw IDOM_DOMException(IDOM_DOMException::INDEX_SIZE_ERR, 0);
unsigned int datLen = XMLString::stringLen(dat);
@@ -274,6 +274,10 @@
unsigned int len = XMLString::stringLen(fData);
+
+ if (offset >= len || offset < 0 || count < 0)
+ throw IDOM_DOMException(IDOM_DOMException::INDEX_SIZE_ERR, 0);
+
XMLCh* newString;
XMLCh temp[4000];
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org