Guard against overflow in CopyImpl if requested count is zero

Bug: v8:9739
Change-Id: I6ec23018e6e2725e47efcc9a5d95dda3713d064e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1803792
Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63812}
This commit is contained in:
Irina Yatsenko 2019-09-13 16:29:03 -07:00 committed by Commit Bot
parent 0999cfb4e8
commit 65a0f7578e

View File

@ -109,6 +109,7 @@ inline void CopyImpl(T* dst_ptr, const T* src_ptr, size_t count) {
DCHECK(((src <= dst) && ((src + count * kTWordSize) <= dst)) ||
((dst <= src) && ((dst + count * kTWordSize) <= src)));
#endif
if (count == 0) return;
// Use block copying MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.