returns 1 if the product is valid, 0 on overflow. negative factors are considered invalid.
| 1037 | // returns 1 if the product is valid, 0 on overflow. |
| 1038 | // negative factors are considered invalid. |
| 1039 | static int stbi__mul2sizes_valid(int a, int b) { |
| 1040 | if (a < 0 || b < 0) |
| 1041 | return 0; |
| 1042 | if (b == 0) |
| 1043 | return 1; // mul-by-0 is always safe |
| 1044 | // portable way to check for no overflows in a*b |
| 1045 | return a <= INT_MAX / b; |
| 1046 | } |
| 1047 | |
| 1048 | #if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || \ |
| 1049 | !defined(STBI_NO_HDR) |
no outgoing calls
no test coverage detected