C++: Test for IntMultToLong on char-typed numbers

This commit is contained in:
Jonas Jensen
2018-09-24 14:29:51 +02:00
parent 7f56be6fe2
commit 2b5d150829
2 changed files with 5 additions and 0 deletions

View File

@@ -88,3 +88,7 @@ void use_printf(float f, double d)
// ^ there's a float -> double varargs promotion here, but it's unlikely that the author anticipates requiring a double
printf("%f", d * d); // safe
}
size_t three_chars(unsigned char a, unsigned char b, unsigned char c) {
return a * b * c; // at most 16581375 [FALSE POSITIVE]
}

View File

@@ -7,3 +7,4 @@
| IntMultToLong.c:61:23:61:33 | ... * ... | Multiplication result may overflow 'int' before it is converted to 'long long'. |
| IntMultToLong.c:63:23:63:40 | ... * ... | Multiplication result may overflow 'int' before it is converted to 'long long'. |
| IntMultToLong.c:75:9:75:13 | ... * ... | Multiplication result may overflow 'int' before it is converted to 'size_t'. |
| IntMultToLong.c:93:12:93:20 | ... * ... | Multiplication result may overflow 'int' before it is converted to 'size_t'. |