diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-01-20 21:33:34 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-01-20 21:33:34 +0300 |
commit | 6000f8545f43b449035cb50382901ce40fb807b0 (patch) | |
tree | a7a8994e625d0e7ec13e2fa016a11af297e04abc /lib/gitlab/diff | |
parent | 0e992a3b4e710f8486a37bfa73ad6981365fceb2 (diff) |
Validate bounds just to be sure
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/inline_diff_marker.rb | 3 |
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 |