You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/05/25 00:23:03 UTC
DO NOT REPLY [Bug 6122] -
DOMString::transcode() maybe have something wrong,
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6122>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6122
DOMString::transcode() maybe have something wrong,
yts@iii.mbox.media.kyoto-u.ac.jp changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version|Windows NT/2K |FreeBSD
Priority|Other |Medium
Version|1.6.0 |1.7.0
------- Additional Comments From yts@iii.mbox.media.kyoto-u.ac.jp 2002-05-24 22:23 -------
If the size esitimate fails, retP should be capped at charsNeeded2, not at charsNeeded. This patch fixes the bug. $ diff -c DOMString.cpp.orig DOMString.cpp *** DOMString.cpp.orig Sat May 25 06:57:51 2002 --- DOMString.cpp Sat May 25 06:46:55 2002 *************** *** 1099,1110 **** --- 1099,1112 ---- // we start with this estimate, and if overflow, then call calcRequiredSize for actual size const unsigned int charsNeeded = fHandle->fLength; char* retP = new char[charsNeeded + 1]; + retP[charsNeeded] = 0; if (!getDomConverter()->transcode(srcP, retP, charsNeeded)) { delete [] retP; const unsigned int charsNeeded2 = getDomConverter()->calcRequiredSize(srcP); retP = new char[charsNeeded2 + 1]; + retP[charsNeeded2] = 0; if (!getDomConverter()->transcode(srcP, retP, charsNeeded2)) { // <TBD> We should throw something here? *************** *** 1112,1119 **** } delete [] allocatedBuf; // which will be null if we didn't allocate one. - // Cap it off and return it - retP[charsNeeded] = 0; return retP; } --- 1114,1119 ----
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org