주요 콘텐츠

C++ Exception Defects

Defects related to C++ exceptions and their handling such as unhandled exception in a noexcept function or unexpected exception raised by a throw statement

These defects are related to C++ exception handling. The defects include:

  • Unhandled exception emitting from a noexcept function

  • Unexpected exception arising during constructing the argument object of a throw statement

  • catch statements catching exceptions by value instead of by reference

  • catch statements hiding subsequent catch statements.

Polyspace 결과

Exception caught by valuecatch statement accepts an object by value
Exception handler hidden by previous handlercatch statement is not reached because of an earlier catch statement for the same exception
Noexcept function exits with exceptionFunctions 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 argument raises unexpected exceptionThe argument expression in a throw statement raises unexpected exceptions, leading to resource leaks and security vulnerabilities
Uncaught exceptionAn exception is raised from a function but it is not caught and handled (R2022b 이후)
Throw argument expression calls newThe 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 Defect Groups

    The Bug Finder defect checkers are classified into groups such as data flow, concurrency, numerical, and so on.