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(); |