Return A + B, exiting if the result would overflow either ptrdiff_t or size_t. A and B are both nonnegative. */
| 124 | /* Return A + B, exiting if the result would overflow either ptrdiff_t |
| 125 | or size_t. A and B are both nonnegative. */ |
| 126 | ATTRIBUTE_PURE_114833_HACK |
| 127 | static ptrdiff_t |
| 128 | sumsize(ptrdiff_t a, ptrdiff_t b) |
| 129 | { |
| 130 | #ifdef ckd_add |
| 131 | ptrdiff_t sum; |
| 132 | if (!ckd_add(&sum, a, b) && sum <= INDEX_MAX) |
| 133 | return sum; |
| 134 | #else |
| 135 | if (a <= INDEX_MAX && b <= INDEX_MAX - a) |
| 136 | return a + b; |
| 137 | #endif |
| 138 | size_overflow(); |
| 139 | } |
| 140 | |
| 141 | |
| 142 | /* Return a pointer to a newly allocated buffer of size SIZE, exiting |
no test coverage detected