Skip to content

Commit bf013bc

Browse files
authored
xcb connect_to_fd* constructors unsound (#2355)
1 parent 61aac21 commit bf013bc

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

crates/xcb/RUSTSEC-0000-0000.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
```toml
2+
[advisory]
3+
id = "RUSTSEC-0000-0000"
4+
package = "xcb"
5+
date = "2025-08-05"
6+
url = "https://github.com/rust-x-bindings/rust-xcb/issues/282"
7+
references = [
8+
"https://github.com/rust-x-bindings/rust-xcb/issues/167",
9+
"https://github.com/rust-x-bindings/rust-xcb/pull/283"
10+
]
11+
informational = "unsound"
12+
13+
[versions]
14+
patched = [">= 1.6.0"]
15+
16+
[affected.functions]
17+
"xcb::Connection::connect_to_fd" = [">= 1.0.0-beta.0"]
18+
"xcb::Connection::connect_to_fd_with_extensions" = [">= 1.0.0-beta.0"]
19+
```
20+
21+
# `xcb::Connection::connect_to_fd*` functions violate I/O safety
22+
23+
The API of `xcb::Connection` has constructors which allow an arbitrary `RawFd`
24+
to be used as a socket connection. On either failure of these constructors or
25+
on the drop of `Connection`, it closes the associated file descriptor. Thus, a
26+
program which uses an `OwnedFd` (such as a `UnixStream`) as the file descriptor
27+
can close the file descriptor and continue to attempt using it or close an
28+
already-closed file descriptor, violating I/O safety.
29+
30+
Starting in version 1.6.0, `xcb` provides `Connection::connect_with_fd` and
31+
`Connection::connect_with_fd_and_extensions` as safe alternatives and
32+
deprecates the problematic functions.

0 commit comments

Comments
 (0)