summaryrefslogtreecommitdiff
path: root/io_buffer.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-12-20 09:03:52 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-12-21 12:25:42 +1300
commit9de5c4ec761aad3edc50b38d9824b40665d18911 (patch)
treef20883478bf71426ca3698e150ca7ac3927a0eeb /io_buffer.c
parent6ad8cf70713e6ae91a8218d4e0034ebbc1983c69 (diff)
downloadruby-9de5c4ec761aad3edc50b38d9824b40665d18911.tar.gz
Fix mapping invalid non-file object.
Diffstat (limited to 'io_buffer.c')
-rw-r--r--io_buffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io_buffer.c b/io_buffer.c
index 524756e041..a97c687239 100644
--- a/io_buffer.c
+++ b/io_buffer.c
@@ -322,6 +322,9 @@ io_buffer_map(int argc, VALUE *argv, VALUE klass)
}
VALUE io = argv[0];
+ if (!RB_TYPE_P(io, T_FILE)) {
+ rb_raise(rb_eArgError, "Must be file/io!");
+ }
size_t size;
if (argc >= 2) {