-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++] Fix dangling reference bug in getRandomName (#8596)
* The current getRandomName function contains a simple dangling reference bug: when it attempts to return a "const char*" string value from the temporary string returned by the stringstream "str" function. This sometimes "works" anyway in release mode, but in debug mode on all the versions of GCC and CLANG I've tried it segfaults. This makes debugging the c++ client very annoying. I also found the method for generating random strings rather obscure. So I both fixed the bug and simplified the code, making use of boost::random to provide a much more straightforward implementation. * Switched to std::random from boost::random, applied clang-format to the changed file.
- Loading branch information
1 parent
72b9f5d
commit 83f0345
Showing
3 changed files
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters