diff options
| author | Misaki Shioi <31817032+shioimm@users.noreply.github.com> | 2025-12-16 19:52:45 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-16 19:52:45 +0900 |
| commit | 2b1a9afbfbb5491665bfbdd560486a310ca49755 (patch) | |
| tree | 0442cb72cb26179edbe58999d416303ff9212f5d /string.c | |
| parent | e42bcd7ce76e75601ef3adf35467edf277471af2 (diff) | |
Fix: Do not pass negative timeout to Addrinfo#connect_internal (#15578)
This change fixes a bug where, with `Socket.tcp`’s `fast_fallback option` disabled, specifying `open_timeout` could unintentionally pass a negative value to `Addrinfo#connect_internal`, `causing an ArgumentError`.
```
❯ ruby -rsocket -e 'p Socket.tcp("localhost", 9292, open_timeout: 1, fast_fallback: false)'
/Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:64:in 'IO#wait_writable': time interval must not be negative (ArgumentError)
sock.wait_writable(timeout) or
^^^^^^^
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:64:in 'Addrinfo#connect_internal'
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:141:in 'Addrinfo#connect'
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:964:in 'block in Socket.tcp_without_fast_fallback'
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:231:in 'Array#each'
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:231:in 'Addrinfo.foreach'
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:945:in 'Socket.tcp_without_fast_fallback'
from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:671:in 'Socket.tcp'
from -e:1:in '<main>'
```
Diffstat (limited to 'string.c')
0 files changed, 0 insertions, 0 deletions
