From f1c8f497232d7850d88e24ac54d7dc725c8ca6b0 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 11 Mar 2017 17:45:18 +0000 Subject: merge revision(s) 57406: [Backport #13149] csv.rb: fix field_size_limit check * lib/csv.rb (CSV#shift): the last column is an Array in extended column since r55985. [ruby-dev:49964] [Bug #13149] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/csv.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/csv.rb b/lib/csv.rb index 03b87983e6..914acb28c7 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -1927,7 +1927,7 @@ class CSV if @io.eof? raise MalformedCSVError, "Unclosed quoted field on line #{lineno + 1}." - elsif @field_size_limit and csv.last.size >= @field_size_limit + elsif @field_size_limit and csv.last.sum(&:size) >= @field_size_limit raise MalformedCSVError, "Field size exceeded on line #{lineno + 1}." end # otherwise, we need to loop and pull some more data to complete the row -- cgit v1.2.3