Skip to content
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

Handle invalid UTF-8 string members #66

Merged
merged 1 commit into from
Jan 10, 2022
Merged

Conversation

m-col
Copy link
Collaborator

@m-col m-col commented Jan 5, 2022

Some struct members are meant to be UTF-8 encoded strings, but bugs in
other software (i.e. clients) can cause them to provide invalid UTF-8
strings. This causes UnicodeDecodeError to be raised when decoding
these to Python strings. This change prevents these errors so that users
of pywlroots don't all need custom logic for bugs in other software.

--

See qtile/qtile#3161 for more info. Qtile (and other pywlroots-using code) could instead catch the UnicodeDecodeError exceptions themselves as an alternative, or they could use wlroots.ffi.string(obj._member).decode(errors="backslashreplace") directly to avoid doing so. Thoughts?

Some struct members are meant to be UTF-8 encoded strings, but bugs in
other software (i.e. clients) can cause them to provide invalid UTF-8
strings. This causes `UnicodeDecodeError` to be raised when decoding
these to Python strings. This change prevents these errors so that users
of pywlroots don't all need custom logic for bugs in other software.
Copy link
Owner

@flacjacket flacjacket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll cut one more 0.14 release with this, then move it to 0.15

@flacjacket flacjacket merged commit f22e9f5 into flacjacket:main Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants