axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicholas Hart <nh...@real.com>
Subject bug in getXSDType()
Date Tue, 23 Jan 2007 18:34:13 GMT

I think I've found a couple bugs in getXSDType, one of which is causing 
a crash.  I believe this was revealed by the recent change made to 
getElement() to check if the type is known/unknown.  getXSDType is 
crashing when it tries to parse the 'nil="true"' attribute in an 
element.  after calling qn.splitQNameString() it doesn't check qn.uri 
fro NULL, which it is in this case.

Previously getElement had some code that looked like this:

         if (0 == strcmp (pName, m_pNode->m_pchNameOrValue))
             bNillFound = isNillValue();
         if (bNillFound || isArrayElement || (pSimpleType->getType() == 
getXSDType(m_pNode))

but now looks like this:

         if (0 == strcmp (pName, m_pNode->m_pchNameOrValue))
             bNillFound = isNillValue();
         bool foundType;
         XSDTYPE theType = getXSDType(m_pNode, foundType);
         if (bNillFound || isArrayElement || (pSimpleType->getType() == 
theType) || !foundType)

so what's happening is before we would skip the call to getXSDType() if 
the element was nil, but now we call getXSDType() every time.  I made 
the attached change and it fixes the crash.

However, I am a little unsure that this code is going to work reliably 
to detect the type (with or without my change).  it looks to me like it 
will treat the very first attribute it finds as the type--and even then 
it will fail if the attribute doesn't have a namespace prefix.





Mime
View raw message