Fix integer overflow: (SIZE_MAX - 1) does not fit in an int64_t.