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

Side by Side Diff: runtime/vm/service.cc

Issue 2298773003: Fix an off-by-one error in vmservice expression evaluation. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 2299
2300 static bool EvaluateInFrame(Thread* thread, JSONStream* js) { 2300 static bool EvaluateInFrame(Thread* thread, JSONStream* js) {
2301 Isolate* isolate = thread->isolate(); 2301 Isolate* isolate = thread->isolate();
2302 if (!isolate->compilation_allowed()) { 2302 if (!isolate->compilation_allowed()) {
2303 js->PrintError(kFeatureDisabled, 2303 js->PrintError(kFeatureDisabled,
2304 "Cannot evaluate when running a precompiled program."); 2304 "Cannot evaluate when running a precompiled program.");
2305 return true; 2305 return true;
2306 } 2306 }
2307 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); 2307 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
2308 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex")); 2308 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex"));
2309 if (framePos > stack->Length()) { 2309 if (framePos >= stack->Length()) {
2310 PrintInvalidParamError(js, "frameIndex"); 2310 PrintInvalidParamError(js, "frameIndex");
2311 return true; 2311 return true;
2312 } 2312 }
2313 ActivationFrame* frame = stack->FrameAt(framePos); 2313 ActivationFrame* frame = stack->FrameAt(framePos);
2314 2314
2315 Zone* zone = thread->zone(); 2315 Zone* zone = thread->zone();
2316 const char* expr = js->LookupParam("expression"); 2316 const char* expr = js->LookupParam("expression");
2317 const String& expr_str = String::Handle(zone, String::New(expr)); 2317 const String& expr_str = String::Handle(zone, String::New(expr));
2318 2318
2319 const Object& result = Object::Handle(zone, frame->Evaluate(expr_str)); 2319 const Object& result = Object::Handle(zone, frame->Evaluate(expr_str));
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 if (strcmp(method_name, method.name) == 0) { 4179 if (strcmp(method_name, method.name) == 0) {
4180 return &method; 4180 return &method;
4181 } 4181 }
4182 } 4182 }
4183 return NULL; 4183 return NULL;
4184 } 4184 }
4185 4185
4186 #endif // !PRODUCT 4186 #endif // !PRODUCT
4187 4187
4188 } // namespace dart 4188 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698