Contenu principal

La traduction de cette page n'est pas à jour. Cliquez ici pour voir la dernière version en anglais.

Défauts d’exceptions C++

Défauts liés aux exceptions C++ et à leur gestion, par exemple exceptions non gérées dans une fonction noexcept ou exceptions inattendues dues à une instruction throw

Ces défauts sont liés à la gestion des exceptions C++. Ces défauts incluent :

  • Exception non gérée provenant d'une fonction noexcept

  • Exception inattendue survenant lors de la construction de l'objet argument d'une instruction throw

  • Instructions catch détectant les exceptions par valeur plutôt que par référence

  • Instructions catch masquant les instructions catch suivantes.

Résultats 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 (depuis 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 (depuis R2023b)

Rubriques

  • Bug Finder Defect Groups

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