C++ 异常缺陷
与 C++ 异常及其处理相关的缺陷,例如,
noexcept
函数中未处理的异常,或由 throw
语句引发的意外异常这些缺陷与 C++ 异常处理相关。这些缺陷包括:
从
noexcept
函数发出的未处理的异常在构造
throw
语句的参量对象时出现的意外异常按值而非按引用捕获异常的
catch
语句隐藏后续
catch
语句的catch
语句
Polyspace 结果
按值捕获异常 | catch statement accepts an object by
value |
异常处理程序被上一处理程序隐藏 | catch statement is not reached because
of an earlier catch statement for the same exception |
Noexcept 函数因异常而退出 | Functions specified as noexcept ,
noexcept(true) or noexcept(<true condition>)
exits with an exception, which causes abnormal termination of program execution, leading to
resource leak and security vulnerability |
Throw 参量出现意外异常 | The argument expression in a throw statement raises unexpected
exceptions, leading to resource leaks and security vulnerabilities |
未捕获异常 | An exception is raised from a function but it is not caught and handled (自 R2022b 起) |
Throw 参量表达式调用 new | The argument expression in a throw statement allocates memory by
calling new , which can result in abrupt termination of the program and
resource leaks (自 R2023b 起) |
主题
- Bug Finder 缺陷组
Bug Finder 的缺陷检查项分为数据流、并发、数值等分组。