Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2017-07-21 15:04:18 +0300
committerNick Thomas <nick@gitlab.com>2017-07-22 09:12:19 +0300
commit4bda5b502de35b7032f8c49a340325aeeb0d7ebe (patch)
tree087887974ab9796546f2ac225e708b0ac803e23d /lib/gitlab/untrusted_regexp.rb
parent754d8caeefdcb887a8a955155cbec436f7ae13c9 (diff)
Short-circuit build coverage extraction for empty regexes
Diffstat (limited to 'lib/gitlab/untrusted_regexp.rb')
-rw-r--r--lib/gitlab/untrusted_regexp.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab/untrusted_regexp.rb b/lib/gitlab/untrusted_regexp.rb
index 925b2158a22..187a9e1145f 100644
--- a/lib/gitlab/untrusted_regexp.rb
+++ b/lib/gitlab/untrusted_regexp.rb
@@ -39,7 +39,12 @@ module Gitlab
groups[1..-1]
end
- text.slice!(0, match.end(0) || 1)
+ matchsize = match.end(0)
+
+ # No further matches
+ break unless matchsize.present?
+
+ text.slice!(0, matchsize)
break unless text.present?
end