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=21990>. 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=21990 ICULCPTranscoder::transcode memory leak ------- Additional Comments From [EMAIL PROTECTED] 2004-02-02 13:59 ------- I found a bug in my patch, sorry. On the second call of ucnv_fromUChars(), converted string could not be null- terminated. Another version of transcode() also have the same problem. I added codes to cap the buffer. The patch is attached. --- ICUTransService.cpp.org 2004-02-02 20:04:24.000000000 +0900 +++ ICUTransService.cpp 2004-02-02 20:11:11.000000000 +0900 @@ -936,6 +936,9 @@ return 0; } + // Cap it off to make sure + retBuf[targetCap] = 0; + return retBuf; } @@ -1037,6 +1040,9 @@ return 0; } + // Cap it off to make sure + retBuf[targetCap] = 0; + return retBuf; } @@ -1255,14 +1261,15 @@ // Use a faux block to enforce a lock on the converter, which will // unlock immediately after its completed. // + int32_t targetCap; UErrorCode err = U_ZERO_ERROR; { XMLMutexLock lockConverter(&fMutex); - ucnv_toUChars + targetCap = ucnv_toUChars ( fConverter , targetBuf - , maxChars + 1 + , maxChars , toTranscode , srcLen , &err @@ -1276,6 +1283,9 @@ return false; } + // Cap it off to make sure + targetBuf[targetCap] = 0; + // If the sizes are not the same, then copy the data over if (sizeof(XMLCh) != sizeof(UChar)) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]