Index: runtime/vm/dart_api_impl.cc |
=================================================================== |
--- runtime/vm/dart_api_impl.cc (revision 20286) |
+++ runtime/vm/dart_api_impl.cc (working copy) |
@@ -4292,7 +4292,8 @@ |
} |
-DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer) { |
+DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, |
+ intptr_t buffer_len) { |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
TIMERSCOPE(time_script_loading); |
@@ -4304,6 +4305,11 @@ |
return Api::NewError("%s expects parameter 'buffer' to be a script type" |
" snapshot.", CURRENT_FUNC); |
} |
+ if (snapshot->length() != buffer_len) { |
+ return Api::NewError("%s: 'buffer_len' of %"Pd" is not equal to %d which" |
+ " is the expected length in the snapshot.", |
+ CURRENT_FUNC, buffer_len, snapshot->length()); |
+ } |
Library& library = |
Library::Handle(isolate, isolate->object_store()->root_library()); |
if (!library.IsNull()) { |