fuzzers: Don't call data() on empty std::vector
UBSAN takes objection to this. Fixed: chromium:1230344 Fixed: chromium:1230346 Fixed: chromium:1230372 Fixed: chromium:1230439 Fixed: chromium:1230457 Change-Id: I351bca06911f2e87f929f08d2aa78a1d8d43d296 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58399 Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
595b0547d4
commit
cdcec6d08c
|
@ -50,9 +50,11 @@ class Reader {
|
|||
return {};
|
||||
}
|
||||
std::vector<T> out(count);
|
||||
memcpy(out.data(), data_, count * sizeof(T));
|
||||
data_ += count * sizeof(T);
|
||||
size_ -= count * sizeof(T);
|
||||
if (!out.empty()) {
|
||||
memcpy(out.data(), data_, count * sizeof(T));
|
||||
data_ += count * sizeof(T);
|
||||
size_ -= count * sizeof(T);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue