summaryrefslogtreecommitdiff
path: root/src/common/page_table.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2020-04-15 14:21:22 -0400
committerGravatar Lioncash2020-04-15 14:43:37 -0400
commite77337588e75adc6e6b8477a8dbe9d1ea8f25c8c (patch)
tree0b6d9732e5276abf734e64dcd708a18da1e931a4 /src/common/page_table.cpp
parentMerge pull request #3662 from ReinUsesLisp/constant-attrs (diff)
downloadyuzu-e77337588e75adc6e6b8477a8dbe9d1ea8f25c8c.tar.gz
yuzu-e77337588e75adc6e6b8477a8dbe9d1ea8f25c8c.tar.xz
yuzu-e77337588e75adc6e6b8477a8dbe9d1ea8f25c8c.zip
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/common/page_table.cpp')
0 files changed, 0 insertions, 0 deletions