OSDN Git Service

Don't abort during app image loading with no boot image
authorMathieu Chartier <mathieuc@google.com>
Mon, 11 Apr 2016 20:56:45 +0000 (13:56 -0700)
committerMathieu Chartier <mathieuc@google.com>
Tue, 12 Apr 2016 01:26:54 +0000 (18:26 -0700)
Fail gracefully instead. Fixes test 119.

Bug: 22858531

(cherry picked from commit e719926c78d6b717ecc0d3d1620a757ae3019d20)

Change-Id: If39e0cf146a3bd03bf23646077e9547dd56ec81c

runtime/gc/space/image_space.cc

index 4dce5a6..7a2b8d7 100644 (file)
@@ -961,9 +961,14 @@ static bool RelocateInPlace(ImageHeader& image_header,
   const size_t pointer_size = image_header.GetPointerSize();
   gc::Heap* const heap = Runtime::Current()->GetHeap();
   heap->GetBootImagesSize(&boot_image_begin, &boot_image_end, &boot_oat_begin, &boot_oat_end);
-  CHECK_NE(boot_image_begin, boot_image_end)
-      << "Can not relocate app image without boot image space";
-  CHECK_NE(boot_oat_begin, boot_oat_end) << "Can not relocate app image without boot oat file";
+  if (boot_image_begin == boot_image_end) {
+    *error_msg = "Can not relocate app image without boot image space";
+    return false;
+  }
+  if (boot_oat_begin == boot_oat_end) {
+    *error_msg = "Can not relocate app image without boot oat file";
+    return false;
+  }
   const uint32_t boot_image_size = boot_image_end - boot_image_begin;
   const uint32_t boot_oat_size = boot_oat_end - boot_oat_begin;
   const uint32_t image_header_boot_image_size = image_header.GetBootImageSize();