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

Unified Diff: net/cert/internal/parse_name.cc

Issue 2865603002: X509NameAttribute::ValueAsString: Decode TeletexString as Latin1. (Closed)
Patch Set: add comment/todo about nacl difference Created 3 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 | « net/BUILD.gn ('k') | net/cert/internal/parse_name_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/parse_name.cc
diff --git a/net/cert/internal/parse_name.cc b/net/cert/internal/parse_name.cc
index d9eaaeed7c86f25de361e8d5f5804f892294a879..f3aa518f1c32b2b9297740ae8f58ccd70c67c4ea 100644
--- a/net/cert/internal/parse_name.cc
+++ b/net/cert/internal/parse_name.cc
@@ -12,6 +12,10 @@
#include "base/sys_byteorder.h"
#include "base/third_party/icu/icu_utf.h"
+#if !defined(OS_NACL)
+#include "net/base/net_string_util.h"
+#endif
+
namespace net {
namespace {
@@ -192,12 +196,14 @@ der::Input TypeDomainComponentOid() {
bool X509NameAttribute::ValueAsString(std::string* out) const {
switch (value_tag) {
case der::kTeletexString:
- for (char c : value.AsStringPiece()) {
- if (c < 32 || c > 126)
- return false;
- }
- *out = value.AsString();
- return true;
+#if !defined(OS_NACL)
+ return ConvertToUtf8(value.AsString(), kCharsetLatin1, out);
+#else
+// For nacl, just fall through to treating like IA5String (ascii).
+// (The nacl build does not include net_string_util and its deps, and a test of
+// adding them increased nacl build size by 100KB.)
+// TODO(mattm): Remove this behavioral difference.
+#endif
case der::kIA5String:
for (char c : value.AsStringPiece()) {
if (static_cast<uint8_t>(c) > 127)
« no previous file with comments | « net/BUILD.gn ('k') | net/cert/internal/parse_name_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698