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,8 +100,10 @@ class CSignatureOf : public CSignature {
static_assert(
std::is_same<decltype(*reps_), decltype(*param_types.data())>::value,
"type mismatch, cannot memcpy");
memcpy(storage_ + kReturnCount, param_types.data(),
sizeof(*storage_) * kParamCount);
if (kParamCount > 0) {
memcpy(storage_ + kReturnCount, param_types.data(),
sizeof(*storage_) * kParamCount);
}
}
private:
......
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