diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-01 22:16:38 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-01 22:16:38 +0000 |
commit | d7a3e8ec24958958db28dba44542a2c126d94e88 (patch) | |
tree | 624b1ccbf82d1bd2586088d624b465c4cfa72ee8 /base/utf_offset_string_conversions.cc | |
parent | 4838a195200c971b1c81bddf7e483f4b95b2017a (diff) | |
download | chromium_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.cc | 3 |
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) && |