Issue #14204 has been reported by normalperson (Eric Wong).

----------------------------------------
Bug #14204: [PATCH] socket: use frozen string buffer when releasing GVL
https://bugs.ruby-lang.org/issues/14204

* Author: normalperson (Eric Wong)
* Status: Open
* Priority: Normal
* Assignee: akr (Akira Tanaka)
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
```
socket: use frozen string buffer when releasing GVL

Using a non-frozen string buffer when GVL is released is
dangerous because another thread may modify that buffer.
This may lead to the contents of an invalid pointer being
written to the socket.

Follow the lead used with core io.c methods and duplicate
the string to a temporary frozen buffer before writing.

* ext/socket/ancdata.c (bsock_sendmsg_internal): use
  rb_str_tmp_frozen_{acquire/release} as with IO#write
* internal.h (rb_str_tmp_frozen_acquire): export
  (rb_str_tmp_frozen_release): export
```

related to [Bug #14195]


---Files--------------------------------
0001-socket-use-frozen-string-buffer-when-releasing-GVL.patch (3.03 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>