Skip to content
Snippets Groups Projects
Commit fd3f2aa4 authored by Alberto Massari's avatar Alberto Massari
Browse files

Fixed infinite loop (XERCESC-1967)

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@1138002 13f79535-47bb-0310-9956-ffa450edef68
parent 98835bb8
No related branches found
No related tags found
No related merge requests found
......@@ -309,22 +309,20 @@ const XMLCh *BinHTTPInputStreamCommon::getEncoding() const
// text/xml, text/xml-external-parsed-entity, or a subtype like text/AnythingAtAll+xml
// has a default encoding of us-ascii
XMLCh* subType = strType+XMLString::stringLen(szTextSlash);
XMLCh* cursor=subType;
int plusPos;
do
BaseRefVectorOf<XMLCh>* tokens=XMLString::tokenizeString(subType, chPlus, fMemoryManager);
for(XMLSize_t i=0;i<tokens->size();i++)
{
plusPos=XMLString::indexOf(cursor, chPlus);
if(plusPos!=-1)
*(cursor+plusPos)=0;
if(XMLString::compareIStringASCII(cursor, szXml)==0 || XMLString::startsWithI(cursor, szXmlDash))
XMLCh* part=tokens->elementAt(i);
if(XMLString::compareIStringASCII(part, szXml)==0 || XMLString::startsWithI(part, szXmlDash))
{
const_cast<BinHTTPInputStreamCommon*>(this)->fEncoding = XMLString::replicate(XMLUni::fgUSASCIIEncodingString, fMemoryManager);
break;
}
cursor+=plusPos+1;
} while(plusPos==-1);
}
if(fEncoding==0)
const_cast<BinHTTPInputStreamCommon*>(this)->fEncoding = XMLString::replicate(XMLUni::fgISO88591EncodingString, fMemoryManager);
delete tokens;
}
}
delete tokens;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment