<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            Undefined Behavior: Redundant Delete

            ABSTRACT

            顯式刪除托管指針將導致程序崩潰或無法正常運行。

            EXPLANATION

            刪除托管指針后,如果指針管理代碼假設該指針仍然有效,將引發程序崩潰或執行錯誤的操作。以下示例可說明這一錯誤。


            std::auto_ptr<foo> p(new foo);
            foo* rawFoo = p.get();
            delete rawFoo;


            僅當托管指針類支持“分離”操作,允許程序員控制特定指針的內存管理時,此規則不適用。如果程序在調用 delete 之前將指針從管理類中分離出來,則管理類知道以后不再使用該指針。

            REFERENCES

            [1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A9 Application Denial of Service

            [2] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP6080 CAT II

            [3] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP6080 CAT II

            [4] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 730

            [5] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.9


            Copyright 2013 Fortify Software - All rights reserved.
            (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
            desc.controlflow.cpp.redundant_delete

            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      亚洲欧美在线