projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5a08199
)
folly: fbvector: ubsan: avoid memcpy(dest, nullptr, 0)
author
Lucian Grijincu
<lucian@fb.com>
Mon, 9 May 2016 19:16:40 +0000
(12:16 -0700)
committer
Facebook Github Bot 4
<facebook-github-bot-4-bot@fb.com>
Mon, 9 May 2016 19:20:26 +0000
(12:20 -0700)
Reviewed By: meyering
Differential Revision:
D3277138
fbshipit-source-id:
7050d18c256ac15c8122d4af59aa31208b1466fd
folly/FBVector.h
patch
|
blob
|
history
diff --git
a/folly/FBVector.h
b/folly/FBVector.h
index e1809f3179370ed5455c7ef93d6d1f5b5547a199..fb611e56c1e4759b8a610d289f55fa6671449d05 100644
(file)
--- a/
folly/FBVector.h
+++ b/
folly/FBVector.h
@@
-636,7
+636,9
@@
private:
}
void relocate_move_or_memcpy(T* dest, T* first, T* last, std::true_type) {
- std::memcpy((void*)dest, (void*)first, (last - first) * sizeof(T));
+ if (first != nullptr) {
+ std::memcpy((void*)dest, (void*)first, (last - first) * sizeof(T));
+ }
}
void relocate_move_or_memcpy(T* dest, T* first, T* last, std::false_type) {