summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/test/string.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-09-19 20:53:32 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-09-19 22:01:59 +0900
commitc09d250ca148c0efc0167d55885bd20da87b43f7 (patch)
treedd1ed14792a5bf45a79d44167556b4206c9698d8 /mrbgems/mruby-string-ext/test/string.rb
parent8b43754644660c9dcdc6b8b18a1917f01e77479e (diff)
downloadmruby-c09d250ca148c0efc0167d55885bd20da87b43f7.tar.gz
mruby-c09d250ca148c0efc0167d55885bd20da87b43f7.zip
Remove implicit conversion using `to_int` method.
The ISO standard does not include implicit type conversion using `to_int`. This implicit conversion often causes vulnerability. There will be no more attacks like #4120. In addition, we have added internal convenience method `__to_int` which does type check and conversion (from floats).
Diffstat (limited to 'mrbgems/mruby-string-ext/test/string.rb')
-rw-r--r--mrbgems/mruby-string-ext/test/string.rb12
1 files changed, 0 insertions, 12 deletions
diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb
index b6146fb90..757b5c50a 100644
--- a/mrbgems/mruby-string-ext/test/string.rb
+++ b/mrbgems/mruby-string-ext/test/string.rb
@@ -31,18 +31,6 @@ assert('String#setbyte') do
assert_equal("Hello", str1)
end
-assert("String#setbyte raises IndexError if arg conversion resizes String") do
- $s = "01234\n"
- class Tmp
- def to_i
- $s.chomp! ''
- 95
- end
- end
- tmp = Tmp.new
- assert_raise(IndexError) { $s.setbyte(5, tmp) }
-end
-
assert('String#byteslice') do
str1 = "hello"
assert_equal("e", str1.byteslice(1))