Commit d45588bd authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Facebook Github Bot 4

folly: fbvector: ubsan: avoid memcpy(dest, nullptr, 0)

Reviewed By: meyering

Differential Revision: D3277138

fbshipit-source-id: 7050d18c256ac15c8122d4af59aa31208b1466fd
parent 5a081994
...@@ -636,8 +636,10 @@ private: ...@@ -636,8 +636,10 @@ private:
} }
void relocate_move_or_memcpy(T* dest, T* first, T* last, std::true_type) { void relocate_move_or_memcpy(T* dest, T* first, T* last, std::true_type) {
if (first != nullptr) {
std::memcpy((void*)dest, (void*)first, (last - first) * sizeof(T)); std::memcpy((void*)dest, (void*)first, (last - first) * sizeof(T));
} }
}
void relocate_move_or_memcpy(T* dest, T* first, T* last, std::false_type) { void relocate_move_or_memcpy(T* dest, T* first, T* last, std::false_type) {
relocate_move_or_copy(dest, first, last, relocate_use_move()); relocate_move_or_copy(dest, first, last, relocate_use_move());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment