From b3c936ed84d36db73df7b278fbf8136090aeefb2 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 1 Jun 2018 17:34:25 -0700 Subject: [PATCH] Log an error and cancel DartVM init if the VM/isolate snapshots are invalid (flutter/engine#5449) See https://github.com/flutter/flutter/issues/18101 --- engine/src/flutter/runtime/dart_vm.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/engine/src/flutter/runtime/dart_vm.cc b/engine/src/flutter/runtime/dart_vm.cc index 5230380db4..422984feb3 100644 --- a/engine/src/flutter/runtime/dart_vm.cc +++ b/engine/src/flutter/runtime/dart_vm.cc @@ -251,9 +251,17 @@ fxl::RefPtr DartVM::ForProcess( if (!vm_snapshot) { vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings); } + if (!(vm_snapshot && vm_snapshot->IsValid())) { + FXL_LOG(ERROR) << "VM snapshot must be valid."; + return; + } if (!isolate_snapshot) { isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings); } + if (!(isolate_snapshot && isolate_snapshot->IsValid())) { + FXL_LOG(ERROR) << "Isolate snapshot must be valid."; + return; + } if (!shared_snapshot) { shared_snapshot = DartSnapshot::Empty(); } @@ -285,12 +293,6 @@ DartVM::DartVM(const Settings& settings, FXL_DLOG(INFO) << "Attempting Dart VM launch for mode: " << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter"); - FXL_DCHECK(vm_snapshot_ && vm_snapshot_->IsValid()) - << "VM snapshot must be valid."; - - FXL_DCHECK(isolate_snapshot_ && isolate_snapshot_->IsValid()) - << "Isolate snapshot must be valid."; - { TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo"); dart::bin::BootstrapDartIo();