diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp index ad3ff6d3cce..279c8ed89f8 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/htmlparser/src/nsDTDUtils.cpp @@ -215,7 +215,7 @@ PRInt32 nsDTDContext::GetCount(void) { */ void nsDTDContext::Push(eHTMLTags aTag) { #ifdef NS_DEBUG - if(mStack.mCount0) + if ((mStack.mCount>0) && (mStack.mCount <= eMaxTags)) mTags[mStack.mCount-1]=eHTMLTag_unknown; #endif @@ -665,7 +665,6 @@ void CObserverDictionary::UnregisterObservers() { nsObserverReleaser theReleaser; for(theIndex=0;theIndexForEach(theReleaser); delete mObservers[theIndex]; } diff --git a/mozilla/htmlparser/src/nsDTDUtils.h b/mozilla/htmlparser/src/nsDTDUtils.h index 5422023baeb..16e1bc38f6c 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.h +++ b/mozilla/htmlparser/src/nsDTDUtils.h @@ -118,7 +118,8 @@ public: nsDeque mSkipped; //each entry will hold a deque full of skipped tokens... nsDeque mStyles; //each entry will hold a tagstack full of style tags... #ifdef NS_DEBUG - eHTMLTags mTags[100]; + enum { eMaxTags = 100 }; + eHTMLTags mTags[eMaxTags]; #endif }; diff --git a/mozilla/htmlparser/src/nsParserNode.cpp b/mozilla/htmlparser/src/nsParserNode.cpp index 0c4138f9b47..b549a50eef6 100644 --- a/mozilla/htmlparser/src/nsParserNode.cpp +++ b/mozilla/htmlparser/src/nsParserNode.cpp @@ -130,7 +130,7 @@ nsresult nsCParserNode::QueryInterface(const nsIID& aIID, void** aInstancePtr) * @return */ void nsCParserNode::AddAttribute(CToken* aToken) { - NS_PRECONDITION(mAttributeCount 0) { CToken* theAttrToken = mAttributes[--mAttributeCount]; mAttributes[mAttributeCount] = nsnull; diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp index ad3ff6d3cce..279c8ed89f8 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp @@ -215,7 +215,7 @@ PRInt32 nsDTDContext::GetCount(void) { */ void nsDTDContext::Push(eHTMLTags aTag) { #ifdef NS_DEBUG - if(mStack.mCount0) + if ((mStack.mCount>0) && (mStack.mCount <= eMaxTags)) mTags[mStack.mCount-1]=eHTMLTag_unknown; #endif @@ -665,7 +665,6 @@ void CObserverDictionary::UnregisterObservers() { nsObserverReleaser theReleaser; for(theIndex=0;theIndexForEach(theReleaser); delete mObservers[theIndex]; } diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.h b/mozilla/parser/htmlparser/src/nsDTDUtils.h index 5422023baeb..16e1bc38f6c 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.h +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.h @@ -118,7 +118,8 @@ public: nsDeque mSkipped; //each entry will hold a deque full of skipped tokens... nsDeque mStyles; //each entry will hold a tagstack full of style tags... #ifdef NS_DEBUG - eHTMLTags mTags[100]; + enum { eMaxTags = 100 }; + eHTMLTags mTags[eMaxTags]; #endif }; diff --git a/mozilla/parser/htmlparser/src/nsParserNode.cpp b/mozilla/parser/htmlparser/src/nsParserNode.cpp index 0c4138f9b47..b549a50eef6 100644 --- a/mozilla/parser/htmlparser/src/nsParserNode.cpp +++ b/mozilla/parser/htmlparser/src/nsParserNode.cpp @@ -130,7 +130,7 @@ nsresult nsCParserNode::QueryInterface(const nsIID& aIID, void** aInstancePtr) * @return */ void nsCParserNode::AddAttribute(CToken* aToken) { - NS_PRECONDITION(mAttributeCount 0) { CToken* theAttrToken = mAttributes[--mAttributeCount]; mAttributes[mAttributeCount] = nsnull;