[xml] Re: Access Violation
- From: Vincent Finn <vincent finn automsoft com>
- To: xml gnome org
- Subject: [xml] Re: Access Violation
- Date: Mon, 28 Jul 2003 16:17:00 +0100
Daniel Veillard wrote:
On Mon, Jul 28, 2003 at 03:15:09PM +0100, Vincent Finn wrote:
I am using it as follows
void fn(xmlNodePtr pOperationElement)
{
xmlNodePtr pEvent = pOperationElement->children;
while (pEvent != NULL)
{
xmlNodePtr pValueText = pValue->children;
const char* bstrValueText = reinterpret_cast<char
const*>(pValueText->content);
// etc...
pEvent = pEvent->next;
}
}
I assume since it looks like heap corruption that I am misusing the library
in some way
Is there anything here that looks wrong to anyone?
accessing ->content without checking the type of the node first
is 100% wrong. You're making assumption which is very likely to be false.
In my case it won't ever be false.
Unless I have misunderstood content is for getting the text from a text
node, in which case I would have thought what I am doing is fine
I know with 100% certainty that the node I am accessing is of the form
<E><V>48471740</V><T>01c354fc14bb8030</T></E>
so I use content to access the text values
As far as I could tell it seemed the same as using
xmlNodeListGetString() but without the need to free the xmlChar which
seemed to be a better solution for me since I am purely reading and want
to avoid any data copying I can
Is using content inherently unsafe?
Vin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]