diff options
author | Jeremy Bopp <jeremy@bopp.net> | 2022-09-11 09:08:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-11 23:08:14 +0900 |
commit | 684353fc03afd6e7c887b65bd18f0b3aeb98101c (patch) | |
tree | 52f3a7e3874617604cf91578bf529803ee6ff8bb /io.c | |
parent | 472e7b8518fbde98be3f0a06192a6695697bf879 (diff) |
[Win32] Negative length `IO#sysread`
Raise `ArgumentError` in `IO#sysread` on Windows when given a negative
length.
Fixes [Bug #18880]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6354
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -3053,7 +3053,8 @@ static int io_setstrbuf(VALUE *str, long len) { #ifdef _WIN32 - len = (len + 1) & ~1L; /* round up for wide char */ + if (len > 0) + len = (len + 1) & ~1L; /* round up for wide char */ #endif if (NIL_P(*str)) { *str = rb_str_new(0, len); |