Added pass to verify structure of dex file.
When a dex file is first opened, this pass runs through to make sure
sizes and offsets of the various sections of the dex file match the
header and don't overlap.
Change-Id: I4900c9665d6572ccfca2fe5f79d5d48ce7252036
diff --git a/src/utf.cc b/src/utf.cc
index 52f03a9..14f511c 100644
--- a/src/utf.cc
+++ b/src/utf.cc
@@ -89,13 +89,16 @@
int CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(const char* utf8_1, const char* utf8_2) {
for (;;) {
- uint16_t c1 = GetUtf16FromUtf8(&utf8_1);
- uint16_t c2 = GetUtf16FromUtf8(&utf8_2);
- if (c1 == 0) {
- return (c2 == 0) ? 0 : -1;
- } else if (c2 == 0) {
+ if (*utf8_1 == '\0') {
+ return (*utf8_2 == '\0') ? 0 : -1;
+ } else if (*utf8_2 == '\0') {
return 1;
- } else if (c1 != c2) {
+ }
+
+ int c1 = GetUtf16FromUtf8(&utf8_1);
+ int c2 = GetUtf16FromUtf8(&utf8_2);
+
+ if (c1 != c2) {
return c1 > c2 ? 1 : -1;
}
}