ART: Correctly compare in UTF-16 space

When trying to cache the locations of constructor names, actually
take care of using UTF-16 comparison, as the string table may
contain strings with UTF-16 codepoints that are incompatible with
strcmp.

Add a crafted test to dex_file_verifier_test

Bug: 110157789
Bug: 78568168
Test: m test-art-host
Change-Id: Ifce56e53522eac2d421b316761ef0adfe341a5b9
(cherry picked from commit c1528176838174896afc001c3ebbc8b8ba06412c)
diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc
index d435945..fda6376 100644
--- a/libdexfile/dex/dex_file_verifier.cc
+++ b/libdexfile/dex/dex_file_verifier.cc
@@ -3056,7 +3056,7 @@
     return reinterpret_cast<const char*>(str_data_ptr);
   };
   auto compare = [&get_string](const DexFile::StringId& lhs, const char* rhs) {
-    return strcmp(get_string(lhs), rhs) < 0;
+    return CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(get_string(lhs), rhs) < 0;
   };
 
   // '=' follows '<'
diff --git a/libdexfile/dex/dex_file_verifier_test.cc b/libdexfile/dex/dex_file_verifier_test.cc
index c9bac0f..65448ca 100644
--- a/libdexfile/dex/dex_file_verifier_test.cc
+++ b/libdexfile/dex/dex_file_verifier_test.cc
@@ -176,6 +176,21 @@
       "Bad index for method flags verification");
 }
 
+TEST_F(DexFileVerifierTest, InitCachingWithUnicode) {
+  static const char kInitWithUnicode[] =
+      "ZGV4CjAzNQDhN60rgMnSK13MoRscTuD+NZe7f6rIkHAAAgAAcAAAAHhWNBIAAAAAAAAAAGwBAAAJ"
+      "AAAAcAAAAAMAAACUAAAAAQAAAKAAAAAAAAAAAAAAAAIAAACsAAAAAQAAALwAAAAkAQAA3AAAANwA"
+      "AADgAAAA5gAAAO4AAAD1AAAAAQEAABUBAAAgAQAAIwEAAAQAAAAFAAAABwAAAAcAAAACAAAAAAAA"
+      "AAAAAAACAAAAAQAAAAIAAAAAAAAAAAAAAAEAAAAAAAAABgAAAAAAAABgAQAAAAAAAAHAgAACwIDA"
+      "gAAGPGluaXQ+AAVIZWxsbwAKTFRlc3RTeW5jOwASTGphdmEvbGFuZy9PYmplY3Q7AAlNYWluLmph"
+      "dmEAAVYABVdvcmxkAAAAAAAAAAYABw4AAAAACgABAAEAAAAwAQAADAAAAHAQAQAJABoBAwAaAggA"
+      "GgMAABoEAQAOAAAAAQAAgIAEuAIAAAwAAAAAAAAAAQAAAAAAAAABAAAACQAAAHAAAAACAAAAAwAA"
+      "AJQAAAADAAAAAQAAAKAAAAAFAAAAAgAAAKwAAAAGAAAAAQAAALwAAAACIAAACQAAANwAAAADEAAA"
+      "AQAAACwBAAADIAAAAQAAADABAAABIAAAAQAAADgBAAAAIAAAAQAAAGABAAAAEAAAAQAAAGwBAAA=";
+  // Just ensure it verifies w/o modification.
+  VerifyModification(kInitWithUnicode, "init_with_unicode", [](DexFile*) {}, nullptr);
+}
+
 // Method flags test class generated from the following smali code. The declared-synchronized
 // flags are there to enforce a 3-byte uLEB128 encoding so we don't have to relayout
 // the code, but we need to remove them before doing tests.