diff options
| author | Lioncash <mathew1800@gmail.com> | 2020-04-15 14:21:22 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2020-04-15 14:43:37 -0400 |
| commit | 77b0e8a37dbcee977a4e3d848d23d19acc2561aa (patch) | |
| tree | 0b6d9732e5276abf734e64dcd708a18da1e931a4 /src/video_core/gpu_thread.cpp | |
| parent | ee439fb0fc0a8a8f5cf7c2c992d0feeb6593535b (diff) | |
file_util: Early-exit in WriteArray and ReadArray if specified lengths are zero
It's undefined behavior to pass a null pointer to std::fread and
std::fwrite, even if the length passed in is zero, so we must perform
the precondition checking ourselves.
A common case where this can occur is when passing in the data of an
empty std::vector and size, as an empty vector will typically have a
null internal buffer.
While we're at it, we can move the implementation out of line and add
debug checks against passing in nullptr to std::fread and std::fwrite.
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
0 files changed, 0 insertions, 0 deletions
