静态内存缺陷
与静态内存编码错误相关的缺陷,如数组访问越界、空指针、标准内存和字符串库等
这些缺陷是在静态分配内存的情况下与内存使用相关的错误。这些缺陷包括:
访问数组时越界
空指针
指针的转换
Polyspace 结果
对空指针执行算术运算 | Arithmetic operation performed on NULL pointer |
数组访问越界 | 数组访问时数组索引超出范围 |
字符串格式设定符不正确导致缓冲区溢出 | 字符串格式指定符导致标准库函数的缓冲区参量溢出 |
字符串操作中目标缓冲区上溢 | Function writes to buffer at offset greater than buffer size |
字符串操作中目标缓冲区下溢 | 函数从缓冲区起始位置的负偏移处写入缓冲区 |
无效的标准库内存例程使用 | Standard library memory function called with invalid arguments |
无效的标准库字符串例程使用 | Standard library string function called with invalid arguments |
对 const 对象执行移动运算 | std::move 函数被声明为 const 或 const& 的对象调用。 |
空指针: | NULL 指针解引用 |
指针访问越界 | 指针在超出其作用域范围外被解引用 |
堆栈变量的指针或引用超出作用域 | Pointer to local variable leaves the variable scope |
在指向不同数组的指针之间做减法或进行比较 | Subtraction or comparison between pointers causes undefined behavior |
不可靠的函数指针转换 | 将函数指针转换为具有不同参量或返回类型的另一个函数指针 |
不可靠的指针转换 | Pointer implicitly cast to different data type |
使用自动变量作为 putenv 族函数参量 | putenv-family function argument not accessible outside its scope |
在没有进行最大大小缓冲区检查的情况下使用路径操作函数 | Destination buffer of getwd or realpath is
smaller than PATH_MAX bytes |
错误分配转换对象的大小 | Allocated memory does not match destination pointer |
主题
- Bug Finder 缺陷组
Bug Finder 的缺陷检查项分为数据流、并发、数值等分组。