Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1056223002: Fix crash when posting a message to a send port with port id 0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 477d3b2bb03653093eecf465525ffc77e50499ed..e77c9c0876c098545de7ee4430d0a3414f05c86f 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1609,6 +1609,9 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
+ if (port_id == ILLEGAL_PORT) {
+ return false;
+ }
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle));
@@ -1622,6 +1625,11 @@ DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) {
+ if (port_id == ILLEGAL_PORT) {
zra 2015/04/04 05:03:47 Should this go after grabbing the current isolate
Cutch 2015/04/05 19:06:09 Done.
+ return Api::NewError("%s: illegal port_id %" Pd64 ".",
+ CURRENT_FUNC,
+ port_id);
+ }
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
CHECK_CALLBACK_STATE(isolate);
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698