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

Unified Diff: pkg/analysis_server/lib/src/search/search_domain.dart

Issue 2160723002: Validate the regex used in search.findTopLevelDeclarations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/search/top_level_declarations_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/search/search_domain.dart
diff --git a/pkg/analysis_server/lib/src/search/search_domain.dart b/pkg/analysis_server/lib/src/search/search_domain.dart
index 4a0e1b7a4eed93d1bc69f3b069862cf01f2f5fa5..37c58a69e5811e06cf039dafa67807aa5422178c 100644
--- a/pkg/analysis_server/lib/src/search/search_domain.dart
+++ b/pkg/analysis_server/lib/src/search/search_domain.dart
@@ -118,6 +118,15 @@ class SearchDomainHandler implements protocol.RequestHandler {
Future findTopLevelDeclarations(protocol.Request request) async {
var params =
new protocol.SearchFindTopLevelDeclarationsParams.fromRequest(request);
+ try {
+ // validate the regex
+ new RegExp(params.pattern);
+ } on FormatException catch (exception) {
+ server.sendResponse(new protocol.Response.invalidParameter(
+ request, 'pattern', exception.message));
+ return;
+ }
+
await server.onAnalysisComplete;
// respond
String searchId = (_nextSearchId++).toString();
« no previous file with comments | « no previous file | pkg/analysis_server/test/search/top_level_declarations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698