JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++


PARSE.BITB : Branch Into try Block

Summary

Control is transferred into a try block using a goto or switch statement.

Code that triggers a warning of this class will trigger further warnings, if the relevant classes are enabled.

See also Branch Into Handler.

This warning class is derived from a C/C++ parser warning.

Properties

Class Name Branch Into try Block
Significance style
Mnemonic PARSE.BITB
Categories
AUTOSARC++14 AUTOSARC++14:M15-0-3 Control shall not be transferred into a try or catch block using a goto or a switch statement.
MisraC++2008 MisraC++2008:15-0-3 Control shall not be transferred into a try or catch block using a goto or a switch statement.
CWE CWE:691 Insufficient Control Flow Management
  CWE:703 Improper Check or Handling of Exceptional Conditions
CERT-C CERT-C:MSC20-C Do not use a switch statement to transfer control into a complex block
JSF++ JSF++:208 C++ exceptions shall not be used (i.e. throw, catch and try shall not be used.)
OWASP-2025 OWASP-2025:A10 Mishandling of Exceptional Conditions
Availability Available for C++ only (not C).
Enabling Checks for this warning class are enabled by default. However, warning instances of this class that are issued as parser errors (rather than parser warnings) will be discarded when using factory configuration settings. To prevent these instances from being discarded, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Branch Into try Block"
To disable checks for this warning class, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Branch Into try Block"

Example

void clean_up(void);
void do_action(void);

void parse_bitb (int i) {
    if (i>0) {
      goto Label_in_try;              // 'Branch Into try Block', 
                                      // ('Goto Statement', and 'Label Not In Enclosing Block' warnings also issued)
    }
    if (i<0) {
      goto Label_in_catch;                          // ('Branch Into Handler', 'Goto Statement', and
                                                    //  'Label Not In Enclosing Block' warnings issued here)
    }
    try {
    Label_in_try:
        do_action();
    }
    catch (...){                                    // ('Use of catch' warning issued here)
    Label_in_catch:
        clean_up();
    }
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.codesecure.com/.