[#107867] Fwd: [ruby-cvs:91197] 8f59482f5d (master): add some tests for Unicode Version 14.0.0 — Martin J. Dürst <duerst@...>
To everybody taking care of continuous integration:
3 messages
2022/03/13
[#108090] [Ruby master Bug#18666] No rule to make target 'yaml/yaml.h', needed by 'api.o' — duerst <noreply@...>
Issue #18666 has been reported by duerst (Martin D端rst).
7 messages
2022/03/28
[#108117] [Ruby master Feature#18668] Merge `io-nonblock` gems into core — "Eregon (Benoit Daloze)" <noreply@...>
Issue #18668 has been reported by Eregon (Benoit Daloze).
22 messages
2022/03/30
[ruby-core:107927] [Ruby master Bug#18638] CSV parse does not honor field_size_limit option unless and until a comma occurs in the data, and field_size_limit is off by one
From:
"Capncavedan (Dan Buettner)" <noreply@...>
Date:
2022-03-16 20:25:21 UTC
List:
ruby-core #107927
Issue #18638 has been reported by Capncavedan (Dan Buettner).
----------------------------------------
Bug #18638: CSV parse does not honor field_size_limit option unless and until a comma occurs in the data, and field_size_limit is off by one
https://bugs.ruby-lang.org/issues/18638
* Author: Capncavedan (Dan Buettner)
* Status: Open
* Priority: Normal
* ruby -v: 3.1.1
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
When using CSV.parse or CSV.foreach and specifying option `field_size_limit: 2_000`, we do not consistently see an exception raised when a field contains over 2,000 characters.
I was finally able to reproduce the issue as occurring only after a comma has occurred within a data field.
I then also found that what could be considered an off-by-one error with respect to "field_size_limit": you need to set a value 1 higher than the maximum field length you want to allow.
This occurs on Ruby 2.7.5 and 3.1.1.
This is a simple ruby script to demonstrate both issues:
```ruby
require "csv"
the_alphabet = ("a".."z").to_a.join
the_alphabet.size # => 26
# this does not honor field_size_limit; it should raise an exception but does not
CSV.parse("\"I am a working man\",\"#{the_alphabet}\"", field_size_limit: 20)
# this raises the proper exception
CSV.parse("\"I am a workin, man\",\"#{the_alphabet}\"", field_size_limit: 20)
# this raises a "Field size exceeded" error, even though field size equals field size limit
CSV.parse("\"I am a workin, man\",\"#{the_alphabet}\"", field_size_limit: the_alphabet.size)
# this works as expected, no exception raised
CSV.parse("\"I am a workin, man\",\"#{the_alphabet}\"", field_size_limit: the_alphabet.size+1)
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>