Skip to content

Conversation

@Arkshine
Copy link
Member

Issue found by Nextra, while playing with contain native and noticed it was not working properly with string containing unicode characters. It's because of a wrong data type conversion where signed char negative values will give 0xffff* resulting failed check e.g. 0xffffc2 == c2.

This is the same issue with set_amxstring, which has been fixed.

amx_SetStringOld has actually a param to handle this situation.
Proposed fix is to use enable last param to use wchar conversion instead.

@Nextra
Copy link
Contributor

Nextra commented May 27, 2014

This is the same bugfix done for set_amxstring in a86ca14 (direct link to change), initially reported in bug 5945.

Everything reaching plugin forwards will currently break if it contains UTF8 characters. I found this because FM_AlertMessage loglines would fail comparison with contain. Using the already existing wchar parameter should be fine.

Arkshine added a commit that referenced this pull request May 27, 2014
Fix an unicode issue with amx_SetStringOld.
@Arkshine Arkshine merged commit 83c2b3e into alliedmodders:master May 27, 2014
@Arkshine Arkshine deleted the fix-unicode-issuee branch May 27, 2014 12:38
@Nextra
Copy link
Contributor

Nextra commented May 27, 2014

And I forgot wchar_t is platform specific. Linux builds are crashing, we need to change it to the unsigned char cast method we used for set_amxstring.

@Arkshine Arkshine restored the fix-unicode-issuee branch May 27, 2014 13:07
Arkshine pushed a commit that referenced this pull request Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants