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

Unified Diff: vm/dart_api_impl.cc

Issue 10115034: Add a missing arity check for top-level methods in Dart_Invoke. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl.cc
===================================================================
--- vm/dart_api_impl.cc (revision 6699)
+++ vm/dart_api_impl.cc (working copy)
@@ -2379,8 +2379,13 @@
}
}
- const Function& function =
- Function::Handle(isolate, lib.LookupLocalFunction(function_name));
+ Function& function = Function::Handle(isolate);
+ function = lib.LookupLocalFunction(function_name);
+ // LookupLocalFunction does not check argument arity, so we do it here.
+ if (!function.IsNull() &&
+ !function.AreValidArgumentCounts(number_of_arguments, 0)) {
+ function = Function::null();
+ }
if (function.IsNull()) {
return Api::NewError("%s: did not find top-level function '%s'.",
CURRENT_FUNC,
« no previous file with comments | « no previous file | vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698