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

ippValidateAttribute: Properly detect strings with an invalid last character #5509

Closed
vliaskov opened this issue Feb 5, 2019 · 3 comments
Closed
Assignees

Comments

@vliaskov
Copy link

vliaskov commented Feb 5, 2019

An ISO/IEC 8859-1 / Latin-1 string with an invalid last character whose UTF8 equivalent is a multi-byte sequence is currently not detected correctly in ippValidateAttribute, leading to a _dbus_check_is_valid_utf8 crash in relaxed conformance mode. The multi-byte sequence check in ippValidateAttribute expects that the following bytes exist, and this is not the case here.

To catch this case, I think ippValidateAttribute needs to check whether the string finishes midway in a multi-byte sequence check for IPP_TAG_TEXT* and IPP_TAG_NAME* strings.

@vliaskov
Copy link
Author

vliaskov commented Feb 5, 2019

If the approach in
vliaskov/cups@4f0f44f
is ok, I can make a PR, let me know.

@michaelrsweet
Copy link
Collaborator

Hmm, I'm not keen on those changes. But I can see how a truncated string or one that sortof looks like UTF-8 could cause this.

@michaelrsweet
Copy link
Collaborator

OK, I refactored the code so that truncated UTF-8 sequences will fail validation.

[master d9f301d] Fix UTF-8 validation (Issue #5509)

[branch-2.2 949c217] Fix UTF-8 validation (Issue #5509)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants