summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_io.rb4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f13e4d9733..7bf970168c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun 14 06:24:57 2015 Benoit Daloze <eregontp@gmail.com>
+
+ * test/ruby/test_io.rb: add test for IO.binread fd leak.
+ See r50881.
+
Sun Jun 14 05:23:51 2015 Benoit Daloze <eregontp@gmail.com>
* io.c (rb_io_s_binread): close fd if seek offset is invalid.
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 873da119be..9b3e80160d 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2740,6 +2740,10 @@ End
end
end
+ def test_s_binread_does_not_leak_with_invalid_offset
+ assert_raise(Errno::EINVAL) { IO.binread(__FILE__, 0, -1) }
+ end
+
def test_s_binwrite
mkcdtmpdir do
path = "test_s_binwrite"