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

Codechange: Remove redundant strlen call #7718

Closed
wants to merge 1 commit into from

Conversation

j-pet
Copy link
Contributor

@j-pet j-pet commented Sep 2, 2019

No description provided.

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

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

Assuming strtolower can never change the string's length...

@j-pet
Copy link
Contributor Author

j-pet commented Sep 2, 2019

Assuming strtolower can never change the string's length...

I made a table with all unicode characters changing the length of the string when lowering case. At least one character ẞ (used in German) will cause a problem. For this reason I decided to close the pull request. Sorry for the inconvenience.

Capital letter name Upper Code U8len Lower Code U8len
Latin capital letter I with dot above İ U+0130 2 i U+0069 1
Latin capital letter A with diagonal stroke Ⱥ U+023A 2 U+2C65 3
Latin capital letter T with diagonal stroke Ⱦ U+023E 2 U+2C66 3
Latin capital letter sharp S U+1E9E 3 ß U+00DF 2
Ohm sign U+2126 3 ω U+03C9 2
Kelvin sign U+212A 3 k U+006B 1
Angstrom sign U+212B 3 å U+00E5 2
Latin capital letter L with middle tilde U+2C62 3 ɫ U+026B 2
Latin capital letter R with tail U+2C64 3 ɽ U+027D 2
Latin capital letter Alpha U+2C6D 3 ɑ U+0251 2
Latin capital letter M with hook U+2C6E 3 ɱ U+0271 2
Latin capital letter turned A U+2C6F 3 ɐ U+0250 2

@j-pet j-pet closed this Sep 2, 2019
@nielsmh
Copy link
Contributor

nielsmh commented Sep 2, 2019

Strictly that makes strtolower() an unsafe function since characters can grow in size, so the buffer may overflow. Place the appropriate number of Ⱥ at the beginning of a string and you can push anything you wish at the end of the string outside the allocated buffer, if it isn't checked.

@j-pet j-pet deleted the codechange branch September 3, 2019 14:59
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.

None yet

3 participants