2791 Definite: Right hand operand of shift operator is negative or too large.
移位操作过大或者是负数
void f1(unsigned long ul, int si) { if (si > 40) { ul = ul << si; /* 2791 */ } } void f2(unsigned long ul, int si) { if (si < 0) { ul = ul << si; /* 2791 */ } }
2845 Constant: Maximum number of characters to be written is larger than the target buffer size.
#include <string.h> extern char a[10]; extern char b[11]; void foo (void) { strncpy (a, b, sizeof (b)); /* 2845 */ }
字符数组 a 溢出了
2871