Rust XCB `xcb::Connection::connect_to_fd*` functions violate I/O safety
Low severity
GitHub Reviewed
Published
Aug 22, 2025
to the GitHub Advisory Database
•
Updated Aug 22, 2025
Description
Published to the GitHub Advisory Database
Aug 22, 2025
Reviewed
Aug 22, 2025
Last updated
Aug 22, 2025
The API of
xcb::Connection
has constructors which allow an arbitraryRawFd
to be used as a socket connection. On either failure of these constructors or on the drop ofConnection
, it closes the associated file descriptor. Thus, a program which uses anOwnedFd
(such as aUnixStream
) as the file descriptor can close the file descriptor and continue to attempt using it or close an already-closed file descriptor, violating I/O safety.Starting in version 1.6.0,
xcb
providesConnection::connect_with_fd
andConnection::connect_with_fd_and_extensions
as safe alternatives and deprecates the problematic functions.References