base::CPU::cpu_brand() should not contain NULs.

BUG=249713

Change-Id: Ic167b497acc2308c0f8222800367e13e3926c0af
Reviewed-on: https://chromium-review.googlesource.com/741547
Commit-Queue: Lei Zhang <[email protected]>
Reviewed-by: Primiano Tucci <[email protected]>
Cr-Commit-Position: refs/heads/master@{#513918}
diff --git a/base/cpu_unittest.cc b/base/cpu_unittest.cc
index 9cabfd6..8a68ea0 100644
--- a/base/cpu_unittest.cc
+++ b/base/cpu_unittest.cc
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 #include "base/cpu.h"
+#include "base/stl_util.h"
 #include "build/build_config.h"
-
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if _MSC_VER >= 1700
@@ -125,3 +125,10 @@
 #endif  // defined(COMPILER_GCC)
 #endif  // defined(ARCH_CPU_X86_FAMILY)
 }
+
+// For https://crbug.com/249713
+TEST(CPU, BrandAndVendorContainsNoNUL) {
+  base::CPU cpu;
+  EXPECT_FALSE(base::ContainsValue(cpu.cpu_brand(), '\0'));
+  EXPECT_FALSE(base::ContainsValue(cpu.vendor_name(), '\0'));
+}