summaryrefslogtreecommitdiff
path: root/src/common/vector_math.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-04-15 14:21:22 -0400
committerLioncash <mathew1800@gmail.com>2020-04-15 14:43:37 -0400
commite77337588e75adc6e6b8477a8dbe9d1ea8f25c8c (patch)
tree0b6d9732e5276abf734e64dcd708a18da1e931a4 /src/common/vector_math.h
parent64b5985f0a034fb2b1988d960b009985f9929922 (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/common/vector_math.h')
0 files changed, 0 insertions, 0 deletions