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

Undefined behaviour when getting address in do_basic_transform #52

Closed
OznOg opened this issue Mar 8, 2020 · 2 comments
Closed

Undefined behaviour when getting address in do_basic_transform #52

OznOg opened this issue Mar 8, 2020 · 2 comments

Comments

@OznOg
Copy link

OznOg commented Mar 8, 2020

in do_basic_transform https://github.com/boostorg/locale/blob/develop/src/icu/collator.cpp#L90
line
int len = collate->getSortKey(str,&tmp[0],tmp.size());

seems wrong as there is no way to make sure tmp is not a 0 sized vector which leads &tmp[0] to be undefined behaviour.
Moreover, on my fedora 30, a vector assertion fails __builtin_expect(__n < this->size(), true) and leads the program to crash.

A fix could be to use tmp.data() instead (if this function is really supposed to handle 0 lenght entry).

@OznOg
Copy link
Author

OznOg commented Nov 14, 2020

a patch is proposed in #60

@OznOg
Copy link
Author

OznOg commented May 17, 2022

was fixed in #72

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

1 participant