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:
authorDouwe Maan <douwe@selenight.nl>2016-01-20 21:33:34 +0300
committerDouwe Maan <douwe@selenight.nl>2016-01-20 21:33:34 +0300
commit6000f8545f43b449035cb50382901ce40fb807b0 (patch)
treea7a8994e625d0e7ec13e2fa016a11af297e04abc /lib/gitlab/diff
parent0e992a3b4e710f8486a37bfa73ad6981365fceb2 (diff)
Validate bounds just to be sure
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r--lib/gitlab/diff/inline_diff_marker.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/gitlab/diff/inline_diff_marker.rb b/lib/gitlab/diff/inline_diff_marker.rb
index 7ca198eeb86..1d7fa1bce06 100644
--- a/lib/gitlab/diff/inline_diff_marker.rb
+++ b/lib/gitlab/diff/inline_diff_marker.rb
@@ -93,6 +93,9 @@ module Gitlab
# Inserts tags around the characters identified by the given range
def insert_around_range(text, range, before, after, offset = 0)
+ # Just to be sure
+ return offset if offset + range.end + 1 > text.length
+
text.insert(offset + range.begin, before)
offset += before.length