-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Fix crash when using String::move on empty string (#10938) #10940
Conversation
👋 Hello TD-er, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 62 files 62 suites 5m 39s ⏱️ Results for commit d024bea. ♻️ This comment has been updated with latest results. |
Use case: Appending to a String with pre-allocated memory (e.g. from `reserve()`)
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
Included in single PR: #10945 |
Description of Change
memmove
should not be called on anullptr
or size of0
.See: https://en.cppreference.com/w/cpp/string/byte/memmove
When an empty string was handed over to move, the application would crash.
The change is just adding an extra check to see if there is something to move.
Related links
Fixes: #10938