Undefined behaviour when getting address in do_basic_transform
OznOg opened this issue · 2 comments
OznOg commented
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).