summaryrefslogtreecommitdiffstats
path: root/base/utf_offset_string_conversions.cc
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-01 22:16:38 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-01 22:16:38 +0000
commitd7a3e8ec24958958db28dba44542a2c126d94e88 (patch)
tree624b1ccbf82d1bd2586088d624b465c4cfa72ee8 /base/utf_offset_string_conversions.cc
parent4838a195200c971b1c81bddf7e483f4b95b2017a (diff)
downloadchromium_src-d7a3e8ec24958958db28dba44542a2c126d94e88.zip
chromium_src-d7a3e8ec24958958db28dba44542a2c126d94e88.tar.gz
chromium_src-d7a3e8ec24958958db28dba44542a2c126d94e88.tar.bz2
If we can't read a unicode character, write the standard "unknown" (0xFFFD) character. This will prevent security issues where the current behaviour can be used to strip characters out of a string after it has passed some validation.
BUG=30798 TEST=utf_string_conversions_unittest.cc,utf_offset_string_conversions_unittest.cc,zip_unittest.cc Review URL: http://codereview.chromium.org/522029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/utf_offset_string_conversions.cc')
-rw-r--r--base/utf_offset_string_conversions.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/base/utf_offset_string_conversions.cc b/base/utf_offset_string_conversions.cc
index 69b572e..4c47ef8 100644
--- a/base/utf_offset_string_conversions.cc
+++ b/base/utf_offset_string_conversions.cc
@@ -36,8 +36,7 @@ bool ConvertUnicode(const SRC_CHAR* src,
if (ReadUnicodeCharacter(src, src_len32, &i, &code_point)) {
chars_written = WriteUnicodeCharacter(code_point, output);
} else {
- // TODO(jungshik): consider adding 'Replacement character' (U+FFFD)
- // in place of an invalid codepoint.
+ chars_written = WriteUnicodeCharacter(0xFFFD, output);
success = false;
}
if ((output_offset != std::wstring::npos) &&