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

Race conditions and possible crashes due to changing locale #9

Closed
myrsloik opened this issue Aug 4, 2019 · 2 comments
Closed

Race conditions and possible crashes due to changing locale #9

myrsloik opened this issue Aug 4, 2019 · 2 comments

Comments

@myrsloik
Copy link

myrsloik commented Aug 4, 2019

You can't change the locale if you're a library. It affects everything else that's also loaded and can actually cause locale related operations in other threads to crash. Apart from all the fun logic errors that can happen in applications that at least assume the decimal separator to be constant.

Just use sscanf_l (_sscanf_l on windows) and do it right. Or use C++ streams where the locale can be set locally as well.

@myrsloik
Copy link
Author

myrsloik commented Aug 4, 2019

Or the other way. Simply convert the arguments to a float array which makes more sense.

@HolyWu
Copy link
Member

HolyWu commented Aug 4, 2019

Thanks for the information. Haven't known that it will have such an influence. I will fix it soon.

By the way I remember seeing KNLMeansCL change the locale for the decimal point issue too.

@HolyWu HolyWu closed this as completed in b5549c6 Aug 5, 2019
HolyWu added a commit that referenced this issue Aug 5, 2019
HolyWu added a commit that referenced this issue Aug 5, 2019
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

No branches or pull requests

2 participants