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]  2003-08-31 15:13 -------
Hi,

I created a new patch.  An error check is added to reconvert a string when ICU 
does not terminate it.  Null-termination by Xerces-code is no longer required.

I checked this patch with the testcase,
http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=8014.
(This is gzipped archive of one cpp file including double-byte characters.)

It works fine with g++-3.2.2 on RedHat 9.


--- ICUTransService.cpp.orig    2003-08-31 23:08:40.000000000 +0900
+++ ICUTransService.cpp 2003-08-31 23:03:34.000000000 +0900
@@ -907,7 +907,7 @@
     }
 
     // If targetLen is not enough then buffer overflow might occur
-    if (err == U_BUFFER_OVERFLOW_ERROR)
+    if ((err == U_BUFFER_OVERFLOW_ERROR) || (err == 
U_STRING_NOT_TERMINATED_WARNING))
     {
         //
         //  Reset the error, delete the old buffer, allocate a new one,
@@ -936,8 +936,6 @@
         return 0;
     }
 
-    // Cap it off and return
-    retBuf[targetCap] = 0;
     return retBuf;
 }
 
@@ -1010,7 +1008,7 @@
     }
 
     // If targetLen is not enough then buffer overflow might occur
-    if (err == U_BUFFER_OVERFLOW_ERROR)
+    if ((err == U_BUFFER_OVERFLOW_ERROR) || (err == 
U_STRING_NOT_TERMINATED_WARNING))
     {
         //
         //  Reset the error, delete the old buffer, allocate a new one,
@@ -1039,8 +1037,6 @@
         return 0;
     }
 
-    // Cap it off and return
-    retBuf[targetCap] = 0;
     return retBuf;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to