Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2817)

Unified Diff: Source/wtf/text/TextEncoding.cpp

Issue 261013007: Prevent direct use of "replacement" text encoding. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MSVC fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/text/TextCodecReplacementTest.cpp ('k') | Source/wtf/text/TextEncodingRegistry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/TextEncoding.cpp
diff --git a/Source/wtf/text/TextEncoding.cpp b/Source/wtf/text/TextEncoding.cpp
index 9adff579120c04ae646a1759407d88bc778569a0..f232e57b2acc6613c5ad807f290a396013ef1504 100644
--- a/Source/wtf/text/TextEncoding.cpp
+++ b/Source/wtf/text/TextEncoding.cpp
@@ -47,12 +47,18 @@ TextEncoding::TextEncoding(const char* name)
: m_name(atomicCanonicalTextEncodingName(name))
, m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
{
+ // Aliases are valid, but not "replacement" itself.
+ if (m_name && isReplacementEncoding(name))
+ m_name = 0;
}
TextEncoding::TextEncoding(const String& name)
: m_name(atomicCanonicalTextEncodingName(name))
, m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
{
+ // Aliases are valid, but not "replacement" itself.
+ if (m_name && isReplacementEncoding(name))
+ m_name = 0;
}
String TextEncoding::decode(const char* data, size_t length, bool stopOnError, bool& sawError) const
« no previous file with comments | « Source/wtf/text/TextCodecReplacementTest.cpp ('k') | Source/wtf/text/TextEncodingRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698