Skip to content

Crash in mod_vcard.erl when user try set special chars #2384

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

Closed
vkatsuba opened this issue Jul 25, 2019 · 5 comments
Closed

Crash in mod_vcard.erl when user try set special chars #2384

vkatsuba opened this issue Jul 25, 2019 · 5 comments
Assignees
Labels
community Non ESL issues and PRs in backlog Community request added to backlog and waiting for implementation.

Comments

@vkatsuba
Copy link
Contributor

vkatsuba commented Jul 25, 2019

MongooseIM version: 3.3.0
Installed from: https://github.com/esl/MongooseIM/tree/3.3.0
Erlang/OTP version: 20

Hi All,

When user try set nickname with special chars like 😊 - the mod_vcard.erl is crashed by reason that inside of mod_vcard.erl is used stringprep:tolower/1, and stringprep:tolower/1 will return atom error for binaries eg: <<240,159,152,138>>. The binary_to_list/1 don't working with atoms, maybe make sense use cowboy_bstr:to_lower/1 instead of stringprep:tolower/1?

cowboy_bstr:to_lower(<<"ABC">>) =:= stringprep:tolower(<<"ABC">>).
true
cowboy_bstr:to_lower(<<240,159,152,138>>).
<<240,159,152,138>>
stringprep:tolower(<<240,159,152,138>>).
error

P.S. I was created ticket about this issue for stringprep - processone/stringprep#9

Cheers!

@fenek
Copy link
Member

fenek commented Aug 22, 2019

Hi @vkatsuba

Let me clarify first - so the problem affects one of vCard fields you're trying to set, right?

@fenek fenek self-assigned this Aug 22, 2019
@vkatsuba
Copy link
Contributor Author

vkatsuba commented Aug 22, 2019

Hi @fenek,

I suppose this can be affects all fields vCard where we can try set special chars and the places where used stringprep:tolower/1

@fenek
Copy link
Member

fenek commented Sep 2, 2019

This problem may actually manifest in more places in MIM code. You are right, that it should be improved. I have created an internal ticket to fix this issue.

@vkatsuba
Copy link
Contributor Author

vkatsuba commented Sep 2, 2019

Hi @fenek, thanks for response

@fenek fenek added community Non ESL issues and PRs in backlog Community request added to backlog and waiting for implementation. labels Oct 7, 2019
@fenek
Copy link
Member

fenek commented Dec 2, 2019

The issue is resolved in the current master.

@fenek fenek closed this as completed Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Non ESL issues and PRs in backlog Community request added to backlog and waiting for implementation.
Projects
None yet
Development

No branches or pull requests

2 participants