Hi Alberto,
Thanks for the prompt reply. This is the relevant piece of code.
NULLCHECK(a, b, c, d) is a macro which checks if a is NULL. If yes, prints a
message using args b and c, and returns the code d.
int XMLParser :: XMLCh2string(XMLCh *xmlch, string &str) {
char *c = NULL;
char whoami[] = "XMLParser::XMLCh2string";
NULLCHECK(xmlch, whoami, "xmlch == NULL", XML_PARSER_INVALID_ARG);
c = XMLString::transcode(xmlch);
NULLCHECK(c, whoami, "XMLString::transcode failed", XML_PARSER_NOMEM);
str = string(c);
XMLString::release(&c);
return XML_PARSER_SUCCESS;
}
int XMLParser :: getStringTypeData(DOMNode *node, string &str) {
DOMNode *child = NULL;
XMLCh *xmlstring = NULL;
string str1("");
char whoami[] = "XMLParser::getWstringTypeData";
NULLCHECK(node, whoami, "node == NULL", XML_PARSER_INVALID_ARG);
child = node->getFirstChild();
NULLCHECK(child, whoami, "child == NULL", XML_PARSER_FAILED);
xmlstring = (XMLCh *)child->getNodeValue();
NULLCHECK(xmlstring, whoami, "xmlstring = NULL", XML_PARSER_NOMEM);
if (XMLCh2string(xmlstring, str1) != XML_PARSER_SUCCESS) {
return XML_PARSER_FAILED;
}
str = str1;
return XML_PARSER_SUCCESS;
}
This function XMLCh2string is used to convert from XMLCh string (which is in
utf16) to a char based string (which is in utf8). There are two problems
that I am facing, and I have one observation.
[1] Debug Error! Damage After Normal Block (#block number) at memory address
(some hex address). This is encountered during XMLString::release()
function.
[2] the constructor of string class, used in "str = string(c)", internally
makes use of strlen. When I use purify to find if there is some memory
related issue, it reports "Array Bounds Read" in function strlen().
[3] If I comment out XMLString::release(&c) line in XMLCh2string() function,
I don't get the Debug Error mentioned in [1].
Thanks
Aditya Kulkarni
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 9:48 PM
To: Aditya Kulkarni
Subject: [jira] Commented: (XERCESC-1290) XMLString::release gives strange
error when string contains Japanese characters
The following comment has been added to this issue:
Author: Alberto Massari
Created: Mon, 18 Oct 2004 9:17 AM
Body:
The error you are seeing is signaling that a buffer overrun has happened (in
debug mode every allocated buffer is terminated with a specific byte
sequence that is checked upon deallocation, and in your case this sequence
has been altered).
Could you post the code you are using?
Thanks,
Alberto
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/XERCESC-1290?page=comments#action_54312
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XERCESC-1290
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XERCESC-1290
Summary: XMLString::release gives strange error when string contains
Japanese characters
Type: Bug
Status: Unassigned
Priority: Critical
Project: Xerces-C++
Assignee:
Reporter: Aditya Kulkarni
Created: Mon, 18 Oct 2004 4:25 AM
Updated: Mon, 18 Oct 2004 9:17 AM
Environment: Windows 2000, MSVC7.1, Not multi-threaded.
Description:
My XML file contains a mixture of Japanese and English characters. For
example, <Vendor>漢字ABCD漢字</Vendor>.
I use XMLString::transcode function to convert the above string (a mix of
Japanese and English) from utf-16 format to utf-8 format. The char buffer
allocated by XMLString::transcode is then released using the
XMLString::release(&char_buffer).
The XMLString::release function gives the following error.
Debug Error!
Damage After Normal Block (#block number) at memory address (some hex
address).
It gives you option of Abort, Retry, Ignore. On selecting ignore, the
program functions as desired.
Thanks
Aditya Kulkarni
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]