diff options
Diffstat (limited to 'ext/stringio/stringio.c')
| -rw-r--r-- | ext/stringio/stringio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index e9ca42e325..41aa71f893 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -167,6 +167,9 @@ strio_readbuf(struct StringIO *ptr, VALUE str) if (!NIL_P(str)) { StringValue(str); rb_str_modify(str); + if (str == ptr->string) { + rb_raise(rb_eArgError, "cannot read into the underlying string"); + } } return str; } |
