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

adding check after utf8string conversion before using it for locale code #1116

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

absaroj
Copy link
Contributor

@absaroj absaroj commented Mar 17, 2023

In some rare cases, when UTF8String fails the conversions from NSString (due to low memory), it returns NULL, which if passed to std::string(), results in undefined behavior.

Adding null check before the std::string and if null then using "und" as unknown language code (as per iso 639).

Copy link
Contributor

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@absaroj absaroj merged commit a4f9b00 into main Mar 21, 2023
@absaroj absaroj deleted the absaroj/fix_crash_for_mau branch March 21, 2023 22:33
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