diff options
author | Jean Boussier <[email protected]> | 2020-05-07 21:49:40 +0200 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2020-05-11 09:15:24 -0700 |
commit | 1258a0fb90ea63bf1ec108815cce0d552acfc726 (patch) | |
tree | b059dab4e959a08791777651b133d80c8459333f /test/ruby/test_name_error.rb | |
parent | 15e977349e31389515bccf7a9684005a0c36e02d (diff) |
Remove the 65 size limit for name_err_mesg_to_str
This limit was introduced on Nov 20 1996
in 554b989ba1623b9f6a0b76f00824c83a23fbcbc1
Apparently to protect from a buffer overflow:
* eval.c (f_missing): オブジェクトの文字列表現が長すぎる時バッファ
を書き潰していた
However I tested that path with very large strings
and it works fine.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3090
Diffstat (limited to 'test/ruby/test_name_error.rb')
-rw-r--r-- | test/ruby/test_name_error.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_name_error.rb b/test/ruby/test_name_error.rb index 102a4a67e8..ec03046c22 100644 --- a/test/ruby/test_name_error.rb +++ b/test/ruby/test_name_error.rb @@ -127,4 +127,17 @@ class TestNameError < Test::Unit::TestCase -> {require ARGV[0]}.call end; end + + def test_large_receiver_inspect + receiver = Class.new do + def self.inspect + 'A' * 120 + end + end + + error = assert_raise(NameError) do + receiver::FOO + end + assert_equal "uninitialized constant #{'A' * 120}::FOO", error.message + end end |