New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creates a string from unvalidated utf8 #96
Comments
This should affect every list of chars in the XML description, I think:
(Well, not really, the above also counts lists that are sent to the X11 server and not only those that are received) Some examples in xproto:
|
For atoms, the name should be in Latin1: https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#requests:InternAtom
However, the X11 server just treats them as a bunch of bytes / a C string. I am not sure what the server does with embedded Anyway, this is the handler for This then does some work with a hash table / a binary tree / I am not quite sure what and uses So, the X11 server will not mind if an atom name is not valid utf8. I see two solutions on how to fix this in xcb-rs and both require API changes:
For convenience, it might make sense to also add |
Before I release fn name(&self) -> Result<&str, Utf8Error>;
fn name_raw(&self) -> &[u8]; |
There is a change of API that I think is more sound. As the X documentation states that the strings (those specified as Constructing x::InternAtom {
only_if_exists: true,
name: b"WM_PROTOCOLS",
} If possible I'd like to receive feedback on this new API before 1.0 is released. I've published |
I have no words:
The text was updated successfully, but these errors were encountered: