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

Unified Diff: pkg/analysis_server/lib/src/protocol.dart

Issue 180743020: guard against invalid request id / method (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
Index: pkg/analysis_server/lib/src/protocol.dart
diff --git a/pkg/analysis_server/lib/src/protocol.dart b/pkg/analysis_server/lib/src/protocol.dart
index 9423825157d03a017efef429bc17f666308a9e62..287b201892b642e79193ca351626a5d0591f8b5f 100644
--- a/pkg/analysis_server/lib/src/protocol.dart
+++ b/pkg/analysis_server/lib/src/protocol.dart
@@ -73,8 +73,11 @@ class Request {
if (result is! Map) {
return null;
}
- String id = result[Request.ID];
- String method = result[Request.METHOD];
+ var id = result[Request.ID];
+ var method = result[Request.METHOD];
+ if (id is! String || method is! String) {
+ return null;
+ }
var params = result[Request.PARAMS];
Request request = new Request(id, method);
if (params is Map) {
Brian Wilkerson 2014/03/05 16:15:16 So it looks like we're returning null if the forma
danrubel 2014/03/05 18:39:07 Good point. Done.
« no previous file with comments | « no previous file | pkg/analysis_server/test/protocol_test.dart » ('j') | pkg/analysis_server/test/protocol_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698