Safely check if multiplying two integers will overflow (no undefined behavior, compiler removing the code, etc...) and output result. */
| 155 | /* Safely check if multiplying two integers will overflow (no undefined |
| 156 | behavior, compiler removing the code, etc...) and output result. */ |
| 157 | static int lodepng_mulofl(size_t a, size_t b, size_t* result) { |
| 158 | *result = a * b; /* Unsigned multiplication is well defined and safe in C90 */ |
| 159 | return (a != 0 && *result / a != b); |
| 160 | } |
| 161 | |
| 162 | #ifdef LODEPNG_COMPILE_ZLIB |
| 163 | /* Safely check if a + b > c, even if overflow could happen. */ |
no outgoing calls
no test coverage detected