summaryrefslogtreecommitdiff
path: root/lib/gitlab/conflict
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-07-29 15:17:06 +0100
committerFatih Acet <acetfatih@gmail.com>2016-08-12 23:24:44 +0300
commit18398152fa4e5237a7b682d955457b12a7d59b31 (patch)
treec5d83e9dd8603ad923d6212045799984cecb8807 /lib/gitlab/conflict
parentf2f844693ecd8a10d48530adf8d59a7c125d2752 (diff)
downloadgitlab-ce-18398152fa4e5237a7b682d955457b12a7d59b31.tar.gz
Raise errors for large and binary files
Diffstat (limited to 'lib/gitlab/conflict')
-rw-r--r--lib/gitlab/conflict/parser.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/conflict/parser.rb b/lib/gitlab/conflict/parser.rb
index 8ab7b6499aa..9f27cba353a 100644
--- a/lib/gitlab/conflict/parser.rb
+++ b/lib/gitlab/conflict/parser.rb
@@ -10,8 +10,12 @@ module Gitlab
class MissingEndDelimiter < ParserError
end
+ class UnmergeableFile < ParserError
+ end
+
def parse(text, our_path:, their_path:, parent: nil)
- return [] if text.blank?
+ raise UnmergeableFile if text.blank? # Typically a binary file
+ raise UnmergeableFile if text.length > 102400
line_obj_index = 0
line_old = 1