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++
Binaries


LANG.ARITH.DIVZERO : ゼロによる割り算

要旨

分母が0になる整数の割り算を実行しようとしています。

プロパティ

クラス名 Division By Zero
日本語クラス名 ゼロによる割り算
クラス分類 信頼性 (reliability)
ニーモニック LANG.ARITH.DIVZERO
カテゴリー
MisraC2025 MisraC2025:1.3 There shall be no occurrence of undefined or critical unspecified behaviour
MisraC2023 MisraC2023:1.3 There shall be no occurrence of undefined or critical unspecified behaviour
Misra2012 Misra2012:1.3 There shall be no occurrence of undefined or critical unspecified behaviour
AUTOSARC++14 AUTOSARC++14:A5-6-1 The right hand operand of the integer division or remainder operators shall not be equal to zero.
MisraC++2023 MisraC++2023:0.3.2 A function call shall not violate the function's preconditions
  MisraC++2023:4.1.3 There shall be no occurrence of undefined or critical unspecified behaviour
CWE CWE:369 Divide By Zero
  CWE:573 Improper Following of Specification by Caller
TS17961 TS17961:5.25-diverr Integer division errors
CERT-C CERT-C:INT33-C Ensure that division and remainder operations do not result in divide-by-zero errors
DISA-3r10 DISA-3r10:V-16808 The designer will ensure the application is not vulnerable to integer arithmetic issues.
OWASP-2025 OWASP-2025:A10 Mishandling of Exceptional Conditions
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Division By Zero"

int divzero(void){
    int c = 5;
    int d;
    d = c*c - 20;       /* 'Unused Value' warning issued here
                         * - d is only used in a statement
                         *   that causes a program crash (via Division by Zero),
                         *   so CodeSonar considers it unused.
                         */
    return d  / (d-c);  /* 'Division By Zero' warning issued here */
}

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。

 

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