mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
fixed bug introduced during OOM fixup causing problems with default
* SAX2.c: fixed bug introduced during OOM fixup causing problems with default namespace when a named prefix with the same href was present (reported on the mailing list by Karl Eichwalder. * xmlstring.c: modified xmlCheckUTF8 with suggested code from Julius Mittenzwei. * dict.c: added a typecast to try to avoid problem reported by Pascal Rodes.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Mon Aug 30 23:36:21 PDT 2004 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* SAX2.c: fixed bug introduced during OOM fixup causing problems
|
||||
with default namespace when a named prefix with the same href
|
||||
was present (reported on the mailing list by Karl Eichwalder.
|
||||
* xmlstring.c: modified xmlCheckUTF8 with suggested code from
|
||||
Julius Mittenzwei.
|
||||
* dict.c: added a typecast to try to avoid problem reported by
|
||||
Pascal Rodes.
|
||||
|
||||
Mon Aug 30 12:45:46 CEST 2004 Kasimier Buchcik <libxml2-cvs@cazic.net>
|
||||
|
||||
* xmlschemas.c: Fixed a bug in xmlSchemasCheckFacet, which did
|
||||
|
4
SAX2.c
4
SAX2.c
@ -2100,12 +2100,10 @@ xmlSAX2StartElementNs(void *ctx,
|
||||
|
||||
/*
|
||||
* Search the namespace if it wasn't already found
|
||||
* Note that, if prefix is NULL, this searches for the default Ns
|
||||
*/
|
||||
if ((URI != NULL) && (ret->ns == NULL)) {
|
||||
if (prefix != NULL)
|
||||
ret->ns = xmlSearchNs(ctxt->myDoc, parent, prefix);
|
||||
else
|
||||
ret->ns = xmlSearchNsByHref(ctxt->myDoc, parent, URI);
|
||||
if (ret->ns == NULL) {
|
||||
ns = xmlNewNs(ret, NULL, prefix);
|
||||
if (ns == NULL) {
|
||||
|
2
dict.c
2
dict.c
@ -708,7 +708,7 @@ xmlDictOwns(xmlDictPtr dict, const xmlChar *str) {
|
||||
return(-1);
|
||||
pool = dict->strings;
|
||||
while (pool != NULL) {
|
||||
if ((str >= pool->array) && (str <= pool->free))
|
||||
if ((str >= &pool->array[0]) && (str <= pool->free))
|
||||
return(1);
|
||||
pool = pool->next;
|
||||
}
|
||||
|
@ -644,56 +644,6 @@ Class xmlDoc(xmlNode)
|
||||
|
||||
# functions from module xpointer
|
||||
xpointerNewContext()
|
||||
Class xpathContext()
|
||||
# accessors
|
||||
contextDoc()
|
||||
contextNode()
|
||||
contextPosition()
|
||||
contextSize()
|
||||
function()
|
||||
functionURI()
|
||||
setContextDoc()
|
||||
setContextNode()
|
||||
|
||||
# functions from module python
|
||||
registerXPathFunction()
|
||||
|
||||
# functions from module xpath
|
||||
xpathEval()
|
||||
xpathEvalExpression()
|
||||
xpathFreeContext()
|
||||
|
||||
# functions from module xpathInternals
|
||||
xpathNewParserContext()
|
||||
xpathNsLookup()
|
||||
xpathRegisterAllFunctions()
|
||||
xpathRegisterNs()
|
||||
xpathRegisteredFuncsCleanup()
|
||||
xpathRegisteredNsCleanup()
|
||||
xpathRegisteredVariablesCleanup()
|
||||
xpathVariableLookup()
|
||||
xpathVariableLookupNS()
|
||||
|
||||
# functions from module xpointer
|
||||
xpointerEval()
|
||||
|
||||
|
||||
Class xmlAttribute(xmlNode)
|
||||
Class catalog()
|
||||
|
||||
# functions from module catalog
|
||||
add()
|
||||
catalogIsEmpty()
|
||||
convertSGMLCatalog()
|
||||
dump()
|
||||
remove()
|
||||
resolve()
|
||||
resolvePublic()
|
||||
resolveSystem()
|
||||
resolveURI()
|
||||
|
||||
|
||||
Class xmlElement(xmlNode)
|
||||
|
||||
|
||||
Class xmlAttr(xmlNode)
|
||||
@ -712,100 +662,12 @@ Class xmlAttr(xmlNode)
|
||||
# functions from module valid
|
||||
removeID()
|
||||
removeRef()
|
||||
|
||||
|
||||
Class xmlTextReader(xmlTextReaderCore)
|
||||
|
||||
# functions from module xmlreader
|
||||
AttributeCount()
|
||||
BaseUri()
|
||||
Close()
|
||||
CurrentDoc()
|
||||
CurrentNode()
|
||||
Depth()
|
||||
Expand()
|
||||
GetAttribute()
|
||||
GetAttributeNo()
|
||||
GetAttributeNs()
|
||||
GetParserProp()
|
||||
GetRemainder()
|
||||
HasAttributes()
|
||||
HasValue()
|
||||
IsDefault()
|
||||
IsEmptyElement()
|
||||
IsValid()
|
||||
LocalName()
|
||||
LookupNamespace()
|
||||
MoveToAttribute()
|
||||
MoveToAttributeNo()
|
||||
MoveToAttributeNs()
|
||||
MoveToElement()
|
||||
MoveToFirstAttribute()
|
||||
MoveToNextAttribute()
|
||||
Name()
|
||||
NamespaceUri()
|
||||
NewDoc()
|
||||
NewFd()
|
||||
NewFile()
|
||||
NewMemory()
|
||||
NewWalker()
|
||||
Next()
|
||||
NextSibling()
|
||||
NodeType()
|
||||
Normalization()
|
||||
Prefix()
|
||||
Preserve()
|
||||
QuoteChar()
|
||||
Read()
|
||||
ReadAttributeValue()
|
||||
ReadInnerXml()
|
||||
ReadOuterXml()
|
||||
ReadState()
|
||||
ReadString()
|
||||
RelaxNGSetSchema()
|
||||
RelaxNGValidate()
|
||||
SetParserProp()
|
||||
String()
|
||||
Value()
|
||||
XmlLang()
|
||||
Class xmlReg()
|
||||
|
||||
# functions from module xmlregexp
|
||||
regexpExec()
|
||||
regexpIsDeterminist()
|
||||
regexpPrint()
|
||||
|
||||
|
||||
Class xmlEntity(xmlNode)
|
||||
|
||||
# functions from module parserInternals
|
||||
handleEntity()
|
||||
Class relaxNgSchema()
|
||||
|
||||
# functions from module relaxng
|
||||
relaxNGDump()
|
||||
relaxNGDumpTree()
|
||||
relaxNGNewValidCtxt()
|
||||
|
||||
# functions from module xmlreader
|
||||
RelaxNGSetSchema()
|
||||
Class Schema()
|
||||
|
||||
# functions from module xmlschemas
|
||||
schemaDump()
|
||||
schemaNewValidCtxt()
|
||||
Class Error()
|
||||
# accessors
|
||||
code()
|
||||
domain()
|
||||
file()
|
||||
level()
|
||||
line()
|
||||
message()
|
||||
|
||||
# functions from module xmlerror
|
||||
copyError()
|
||||
resetError()
|
||||
Class relaxNgValidCtxt()
|
||||
|
||||
# functions from module relaxng
|
||||
@ -814,73 +676,6 @@ Class relaxNgValidCtxt()
|
||||
relaxNGValidatePopElement()
|
||||
relaxNGValidatePushCData()
|
||||
relaxNGValidatePushElement()
|
||||
Class xpathParserContext()
|
||||
# accessors
|
||||
context()
|
||||
|
||||
# functions from module xpathInternals
|
||||
xpathAddValues()
|
||||
xpathBooleanFunction()
|
||||
xpathCeilingFunction()
|
||||
xpathCompareValues()
|
||||
xpathConcatFunction()
|
||||
xpathContainsFunction()
|
||||
xpathCountFunction()
|
||||
xpathDivValues()
|
||||
xpathEqualValues()
|
||||
xpathErr()
|
||||
xpathEvalExpr()
|
||||
xpathFalseFunction()
|
||||
xpathFloorFunction()
|
||||
xpathFreeParserContext()
|
||||
xpathIdFunction()
|
||||
xpathLangFunction()
|
||||
xpathLastFunction()
|
||||
xpathLocalNameFunction()
|
||||
xpathModValues()
|
||||
xpathMultValues()
|
||||
xpathNamespaceURIFunction()
|
||||
xpathNextAncestor()
|
||||
xpathNextAncestorOrSelf()
|
||||
xpathNextAttribute()
|
||||
xpathNextChild()
|
||||
xpathNextDescendant()
|
||||
xpathNextDescendantOrSelf()
|
||||
xpathNextFollowing()
|
||||
xpathNextFollowingSibling()
|
||||
xpathNextNamespace()
|
||||
xpathNextParent()
|
||||
xpathNextPreceding()
|
||||
xpathNextPrecedingSibling()
|
||||
xpathNextSelf()
|
||||
xpathNormalizeFunction()
|
||||
xpathNotEqualValues()
|
||||
xpathNotFunction()
|
||||
xpathNumberFunction()
|
||||
xpathParseNCName()
|
||||
xpathParseName()
|
||||
xpathPopBoolean()
|
||||
xpathPopNumber()
|
||||
xpathPopString()
|
||||
xpathPositionFunction()
|
||||
xpathRoot()
|
||||
xpathRoundFunction()
|
||||
xpathStartsWithFunction()
|
||||
xpathStringFunction()
|
||||
xpathStringLengthFunction()
|
||||
xpathSubValues()
|
||||
xpathSubstringAfterFunction()
|
||||
xpathSubstringBeforeFunction()
|
||||
xpathSubstringFunction()
|
||||
xpathSumFunction()
|
||||
xpathTranslateFunction()
|
||||
xpathTrueFunction()
|
||||
xpathValueFlipSign()
|
||||
xpatherror()
|
||||
|
||||
# functions from module xpointer
|
||||
xpointerEvalRangePredicate()
|
||||
xpointerRangeToFunction()
|
||||
|
||||
|
||||
Class parserCtxt(parserCtxtCore)
|
||||
@ -988,6 +783,94 @@ Class xmlDtd(xmlNode)
|
||||
dtdElementDesc()
|
||||
dtdQAttrDesc()
|
||||
dtdQElementDesc()
|
||||
Class relaxNgParserCtxt()
|
||||
|
||||
# functions from module relaxng
|
||||
relaxNGParse()
|
||||
relaxParserSetFlag()
|
||||
Class xpathParserContext()
|
||||
# accessors
|
||||
context()
|
||||
|
||||
# functions from module xpathInternals
|
||||
xpathAddValues()
|
||||
xpathBooleanFunction()
|
||||
xpathCeilingFunction()
|
||||
xpathCompareValues()
|
||||
xpathConcatFunction()
|
||||
xpathContainsFunction()
|
||||
xpathCountFunction()
|
||||
xpathDivValues()
|
||||
xpathEqualValues()
|
||||
xpathErr()
|
||||
xpathEvalExpr()
|
||||
xpathFalseFunction()
|
||||
xpathFloorFunction()
|
||||
xpathFreeParserContext()
|
||||
xpathIdFunction()
|
||||
xpathLangFunction()
|
||||
xpathLastFunction()
|
||||
xpathLocalNameFunction()
|
||||
xpathModValues()
|
||||
xpathMultValues()
|
||||
xpathNamespaceURIFunction()
|
||||
xpathNextAncestor()
|
||||
xpathNextAncestorOrSelf()
|
||||
xpathNextAttribute()
|
||||
xpathNextChild()
|
||||
xpathNextDescendant()
|
||||
xpathNextDescendantOrSelf()
|
||||
xpathNextFollowing()
|
||||
xpathNextFollowingSibling()
|
||||
xpathNextNamespace()
|
||||
xpathNextParent()
|
||||
xpathNextPreceding()
|
||||
xpathNextPrecedingSibling()
|
||||
xpathNextSelf()
|
||||
xpathNormalizeFunction()
|
||||
xpathNotEqualValues()
|
||||
xpathNotFunction()
|
||||
xpathNumberFunction()
|
||||
xpathParseNCName()
|
||||
xpathParseName()
|
||||
xpathPopBoolean()
|
||||
xpathPopNumber()
|
||||
xpathPopString()
|
||||
xpathPositionFunction()
|
||||
xpathRoot()
|
||||
xpathRoundFunction()
|
||||
xpathStartsWithFunction()
|
||||
xpathStringFunction()
|
||||
xpathStringLengthFunction()
|
||||
xpathSubValues()
|
||||
xpathSubstringAfterFunction()
|
||||
xpathSubstringBeforeFunction()
|
||||
xpathSubstringFunction()
|
||||
xpathSumFunction()
|
||||
xpathTranslateFunction()
|
||||
xpathTrueFunction()
|
||||
xpathValueFlipSign()
|
||||
xpatherror()
|
||||
|
||||
# functions from module xpointer
|
||||
xpointerEvalRangePredicate()
|
||||
xpointerRangeToFunction()
|
||||
Class SchemaParserCtxt()
|
||||
|
||||
# functions from module xmlschemas
|
||||
schemaParse()
|
||||
Class catalog()
|
||||
|
||||
# functions from module catalog
|
||||
add()
|
||||
catalogIsEmpty()
|
||||
convertSGMLCatalog()
|
||||
dump()
|
||||
remove()
|
||||
resolve()
|
||||
resolvePublic()
|
||||
resolveSystem()
|
||||
resolveURI()
|
||||
|
||||
|
||||
Class xmlNs(xmlNode)
|
||||
@ -1011,48 +894,6 @@ Class xmlNs(xmlNode)
|
||||
|
||||
# functions from module xpathInternals
|
||||
xpathNodeSetFreeNs()
|
||||
|
||||
|
||||
Class inputBuffer(ioReadWrapper)
|
||||
|
||||
# functions from module xmlIO
|
||||
grow()
|
||||
push()
|
||||
read()
|
||||
|
||||
# functions from module xmlreader
|
||||
newTextReader()
|
||||
Class relaxNgParserCtxt()
|
||||
|
||||
# functions from module relaxng
|
||||
relaxNGParse()
|
||||
relaxParserSetFlag()
|
||||
|
||||
|
||||
Class outputBuffer(ioWriteWrapper)
|
||||
|
||||
# functions from module HTMLtree
|
||||
htmlDocContentDumpFormatOutput()
|
||||
htmlDocContentDumpOutput()
|
||||
htmlNodeDumpFormatOutput()
|
||||
htmlNodeDumpOutput()
|
||||
|
||||
# functions from module tree
|
||||
nodeDumpOutput()
|
||||
saveFileTo()
|
||||
saveFormatFileTo()
|
||||
|
||||
# functions from module xmlIO
|
||||
write()
|
||||
writeString()
|
||||
Class SchemaParserCtxt()
|
||||
|
||||
# functions from module xmlschemas
|
||||
schemaParse()
|
||||
Class SchemaValidCtxt()
|
||||
|
||||
# functions from module xmlschemas
|
||||
schemaValidateDoc()
|
||||
Class xmlTextReaderLocator()
|
||||
|
||||
# functions from module xmlreader
|
||||
@ -1083,3 +924,162 @@ Class URI()
|
||||
parseURIReference()
|
||||
printURI()
|
||||
saveUri()
|
||||
|
||||
|
||||
Class xmlAttribute(xmlNode)
|
||||
Class xpathContext()
|
||||
# accessors
|
||||
contextDoc()
|
||||
contextNode()
|
||||
contextPosition()
|
||||
contextSize()
|
||||
function()
|
||||
functionURI()
|
||||
setContextDoc()
|
||||
setContextNode()
|
||||
|
||||
# functions from module python
|
||||
registerXPathFunction()
|
||||
|
||||
# functions from module xpath
|
||||
xpathEval()
|
||||
xpathEvalExpression()
|
||||
xpathFreeContext()
|
||||
|
||||
# functions from module xpathInternals
|
||||
xpathNewParserContext()
|
||||
xpathNsLookup()
|
||||
xpathRegisterAllFunctions()
|
||||
xpathRegisterNs()
|
||||
xpathRegisteredFuncsCleanup()
|
||||
xpathRegisteredNsCleanup()
|
||||
xpathRegisteredVariablesCleanup()
|
||||
xpathVariableLookup()
|
||||
xpathVariableLookupNS()
|
||||
|
||||
# functions from module xpointer
|
||||
xpointerEval()
|
||||
|
||||
|
||||
Class xmlElement(xmlNode)
|
||||
|
||||
|
||||
Class xmlTextReader(xmlTextReaderCore)
|
||||
|
||||
# functions from module xmlreader
|
||||
AttributeCount()
|
||||
BaseUri()
|
||||
Close()
|
||||
CurrentDoc()
|
||||
CurrentNode()
|
||||
Depth()
|
||||
Expand()
|
||||
GetAttribute()
|
||||
GetAttributeNo()
|
||||
GetAttributeNs()
|
||||
GetParserProp()
|
||||
GetRemainder()
|
||||
HasAttributes()
|
||||
HasValue()
|
||||
IsDefault()
|
||||
IsEmptyElement()
|
||||
IsValid()
|
||||
LocalName()
|
||||
LookupNamespace()
|
||||
MoveToAttribute()
|
||||
MoveToAttributeNo()
|
||||
MoveToAttributeNs()
|
||||
MoveToElement()
|
||||
MoveToFirstAttribute()
|
||||
MoveToNextAttribute()
|
||||
Name()
|
||||
NamespaceUri()
|
||||
NewDoc()
|
||||
NewFd()
|
||||
NewFile()
|
||||
NewMemory()
|
||||
NewWalker()
|
||||
Next()
|
||||
NextSibling()
|
||||
NodeType()
|
||||
Normalization()
|
||||
Prefix()
|
||||
Preserve()
|
||||
QuoteChar()
|
||||
Read()
|
||||
ReadAttributeValue()
|
||||
ReadInnerXml()
|
||||
ReadOuterXml()
|
||||
ReadState()
|
||||
ReadString()
|
||||
RelaxNGSetSchema()
|
||||
RelaxNGValidate()
|
||||
SetParserProp()
|
||||
String()
|
||||
Value()
|
||||
XmlLang()
|
||||
|
||||
|
||||
Class xmlEntity(xmlNode)
|
||||
|
||||
# functions from module parserInternals
|
||||
handleEntity()
|
||||
Class Schema()
|
||||
|
||||
# functions from module xmlschemas
|
||||
schemaDump()
|
||||
schemaNewValidCtxt()
|
||||
Class Error()
|
||||
# accessors
|
||||
code()
|
||||
domain()
|
||||
file()
|
||||
level()
|
||||
line()
|
||||
message()
|
||||
|
||||
# functions from module xmlerror
|
||||
copyError()
|
||||
resetError()
|
||||
Class relaxNgSchema()
|
||||
|
||||
# functions from module relaxng
|
||||
relaxNGDump()
|
||||
relaxNGDumpTree()
|
||||
relaxNGNewValidCtxt()
|
||||
|
||||
# functions from module xmlreader
|
||||
RelaxNGSetSchema()
|
||||
|
||||
|
||||
Class inputBuffer(ioReadWrapper)
|
||||
|
||||
# functions from module xmlIO
|
||||
grow()
|
||||
push()
|
||||
read()
|
||||
|
||||
# functions from module xmlreader
|
||||
newTextReader()
|
||||
Class SchemaValidCtxt()
|
||||
|
||||
# functions from module xmlschemas
|
||||
schemaValidateDoc()
|
||||
|
||||
|
||||
Class outputBuffer(ioWriteWrapper)
|
||||
|
||||
# functions from module HTMLtree
|
||||
htmlDocContentDumpFormatOutput()
|
||||
htmlDocContentDumpOutput()
|
||||
htmlNodeDumpFormatOutput()
|
||||
htmlNodeDumpOutput()
|
||||
|
||||
# functions from module tree
|
||||
nodeDumpOutput()
|
||||
saveFileTo()
|
||||
saveFormatFileTo()
|
||||
|
||||
# functions from module xmlIO
|
||||
write()
|
||||
writeString()
|
||||
|
52
xmlstring.c
52
xmlstring.c
@ -773,41 +773,25 @@ xmlCheckUTF8(const unsigned char *utf)
|
||||
* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx valid 4-byte
|
||||
*/
|
||||
for (ix = 0; (c = utf[ix]);) { /* string is 0-terminated */
|
||||
if (c & 0x80) { /* if it is not a single byte */
|
||||
/*
|
||||
* We know the first byte starts with '1', so check
|
||||
* the following bits and bytes.
|
||||
*
|
||||
* if the first byte does *not* start with 1 1, or the
|
||||
* second byte does *not* start with 1 0 it's an error
|
||||
*/
|
||||
if (((c & 0xc0) != 0xc0) || ((utf[ix + 1] & 0xc0) != 0x80))
|
||||
return(0);
|
||||
/*
|
||||
* if the first three bits are set then the 3rd byte *must* start
|
||||
* with 1 0
|
||||
*/
|
||||
if ((c & 0xe0) == 0xe0) {
|
||||
if ((utf[ix + 2] & 0xc0) != 0x80)
|
||||
return(0);
|
||||
/*
|
||||
* if the first four bits are set then the fifth bit
|
||||
* must not be set, and the 4th byte *must* start with 1 0
|
||||
*/
|
||||
if ((c & 0xf0) == 0xf0) {
|
||||
if ((c & 0xf8) != 0xf0 || (utf[ix + 3] & 0xc0) != 0x80)
|
||||
return(0);
|
||||
ix += 4;
|
||||
/* 4-byte code */
|
||||
} else
|
||||
/* 3-byte code */
|
||||
ix += 3;
|
||||
} else
|
||||
/* 2-byte code */
|
||||
ix += 2;
|
||||
} else
|
||||
/* 1-byte code */
|
||||
if (c & 0x80) { /* 1-byte code, starts with 10 */
|
||||
ix++;
|
||||
} else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */
|
||||
if ((utf[ix+1] & 0xc0 ) != 0x80)
|
||||
return 0;
|
||||
ix += 2;
|
||||
} else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */
|
||||
if (((utf[ix+1] & 0xc0) != 0x80) ||
|
||||
((utf[ix+2] & 0xc0) != 0x80))
|
||||
return 0;
|
||||
ix += 3;
|
||||
} else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */
|
||||
if (((utf[ix+1] & 0xc0) != 0x80) ||
|
||||
((utf[ix+2] & 0xc0) != 0x80) ||
|
||||
((utf[ix+3] & 0xc0) != 0x80))
|
||||
return 0;
|
||||
ix += 4;
|
||||
} else /* unknown encoding */
|
||||
return 0;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user