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

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: address comments (re-upload) 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/protocol_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bce1eb48e12bbc5caf26aaff965fdab7d2c70f2c 100644
--- a/pkg/analysis_server/lib/src/protocol.dart
+++ b/pkg/analysis_server/lib/src/protocol.dart
@@ -73,14 +73,19 @@ 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) {
params.forEach((String key, Object value) {
request.setParameter(key, value);
});
+ } else if (params != null) {
+ return null;
}
return request;
} catch (exception) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/protocol_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698