Return f in case of signed integer overflow or negative parameters or v1+v2 otherwise. We use it for file offsets, which are signed for compatibility with off_t in POSIX file functions and third party code. Signed integer overflow is the undefined behavior according to C++ standard and it causes fuzzers to complain.
| 129 | // Signed integer overflow is the undefined behavior according to |
| 130 | // C++ standard and it causes fuzzers to complain. |
| 131 | inline int64 SafeAdd(int64 v1,int64 v2,int64 f) |
| 132 | { |
| 133 | return v1>=0 && v2>=0 && v1<=MAX_INT64-v2 ? v1+v2 : f; |
| 134 | } |
| 135 | |
| 136 | |
| 137 | size_t Archive::ReadHeader15() |
no outgoing calls
no test coverage detected