Commit 587e7163 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[test] Fix UBSan failure

UBSan starts complaining about a nullptr destination in memcpy after
https://crrev.com/c/2691828.
This CL fixes the error by not copying if there is nothing to copy.

R=nicohartmann@chromium.org

No-Try: true
No-Tree-Checks: true
Change-Id: I2c941b37d26931d6c2253bc3bb2c0aa659d4cb71
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2690605
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72690}
parent e5cf754b
...@@ -100,9 +100,11 @@ class CSignatureOf : public CSignature { ...@@ -100,9 +100,11 @@ class CSignatureOf : public CSignature {
static_assert( static_assert(
std::is_same<decltype(*reps_), decltype(*param_types.data())>::value, std::is_same<decltype(*reps_), decltype(*param_types.data())>::value,
"type mismatch, cannot memcpy"); "type mismatch, cannot memcpy");
if (kParamCount > 0) {
memcpy(storage_ + kReturnCount, param_types.data(), memcpy(storage_ + kReturnCount, param_types.data(),
sizeof(*storage_) * kParamCount); sizeof(*storage_) * kParamCount);
} }
}
private: private:
static constexpr size_t kReturnCount = static constexpr size_t kReturnCount =
......
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