OSDN Git Service

ART: Fix oatdump dex export
authorAndreas Gampe <agampe@google.com>
Fri, 17 Feb 2017 18:19:44 +0000 (10:19 -0800)
committerAndreas Gampe <agampe@google.com>
Fri, 17 Feb 2017 18:19:44 +0000 (10:19 -0800)
Check for start index.

Bug: 35459241
Test: m
Test: m test-art-host-gtest-oatdump_test
Change-Id: I655d7be93427fd219ec445187c1d49076883bd3e

oatdump/oatdump.cc

index 4413286..a0919a1 100644 (file)
@@ -1018,7 +1018,9 @@ class OatDumper {
       dex_orig_name = dex_file_location.substr(dex_orig_pos + 1);
 
     // A more elegant approach to efficiently name user installed apps is welcome
-    if (dex_orig_name.size() == 8 && !dex_orig_name.compare("base.apk")) {
+    if (dex_orig_name.size() == 8 &&
+        dex_orig_name.compare("base.apk") == 0 &&
+        dex_orig_pos != std::string::npos) {
       dex_file_location.erase(dex_orig_pos, strlen("base.apk") + 1);
       size_t apk_orig_pos = dex_file_location.rfind('/');
       if (apk_orig_pos != std::string::npos) {