You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2001/06/23 07:27:13 UTC
cvs commit: xml-xerces/c/src/util/Transcoders/MacOSUnicodeConverter MacOSUnicodeConverter.cpp
jberry 01/06/22 22:27:13
Modified: c/src/util/Transcoders/MacOSUnicodeConverter
MacOSUnicodeConverter.cpp
Log:
Fix bug #2277: size of output buffer to ConvertFromUnicodeText in calcRequiredSize was specified incorrectly; buffer overflow could result. Thanks to Eric Cole.
Revision Changes Path
1.9 +9 -6 xml-xerces/c/src/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
Index: MacOSUnicodeConverter.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MacOSUnicodeConverter.cpp 2001/05/22 20:37:47 1.8
+++ MacOSUnicodeConverter.cpp 2001/06/23 05:27:13 1.9
@@ -55,7 +55,7 @@
*/
/*
- * $Id: MacOSUnicodeConverter.cpp,v 1.8 2001/05/22 20:37:47 jberry Exp $
+ * $Id: MacOSUnicodeConverter.cpp,v 1.9 2001/06/23 05:27:13 jberry Exp $
*/
@@ -105,8 +105,11 @@
// a mismatch between UniChar (the 16-bit type that the Unicode converter uses)
// and wchar_t (the type the compiler uses to represent a Unicode character).
// In the case of Metrowerks, these are the same size. For ProjectBuilder, they
-// differ. TempUniBuf is also used for a few cases where we want to discard the
-// output fromt he unicode converter.
+// used to differ, but they are now the same since XMLCh is now always fixed
+// as a 16 bit character, rather than floating with wchar_t as it used to.
+// *** Most uses of this buffer should be removed from this code in time! ***
+// TempUniBuf is also used for a few cases where we want to discard the
+// output from the unicode converter.
const std::size_t kTempUniBufCount = 256;
typedef UniChar TempUniBuf[kTempUniBufCount];
@@ -789,7 +792,7 @@
// In order to implement calcRequiredSize we have to go ahead and do the
// conversion, which seems quite painful. The Mac Unicode converter has
// no way of saying "don't actually do the conversion." So we end up
-// converting twic. It would be nice if the calling code could do some
+// converting twice. It would be nice if the calling code could do some
// extra buffering to avoid this result.
// ---------------------------------------------------------------------------
unsigned int
@@ -853,7 +856,7 @@
// In order to implement calcRequiredSize we have to go ahead and do the
// conversion, which seems quite painful. The Mac Unicode converter has
// no way of saying "don't actually do the conversion." So we end up
-// converting twic. It would be nice if the calling code could do some
+// converting twice. It would be nice if the calling code could do some
// extra buffering to avoid this result.
// ---------------------------------------------------------------------------
unsigned int
@@ -896,7 +899,7 @@
passSrc = reinterpret_cast<const UniChar*>(src);
}
- char oBuf[kTempUniBufCount];
+ TempUniBuf oBuf;
status = ConvertFromUnicodeToText(
mUnicodeToTextInfo,
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org