3
References
[REF-961]Object Management Group (OMG). "Automated Source Code Reliability Measure
(ASCRM)". 2016 January. < http://www.omg.org/spec/ASCRM/1.0/ >.
CWE-1071: Empty Code Block
Weakness ID : 1071
Structure : Simple
Abstraction : Base
Description
The source code contains a block that does not contain any code, i.e., the block is empty.
Extended Description
Empty code blocks can occur in the bodies of conditionals, function or method definitions,
exception handlers, etc. While an empty code block might be intentional, it might also indicate
incomplete implementation, accidental code deletion, unexpected macro expansion, etc. For some
programming languages and constructs, an empty block might be allowed by the syntax, but the
lack of any behavior within the block might violate a convention or API in such a way that it is an
error.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 1164 Irrelevant Code 1967
ParentOf 585 Empty Synchronized Block 1318
ParentOf 1069 Empty Exception Block 1907
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 1006 Bad Coding Practices 2422
Weakness Ordinalities
Indirect :
Common Consequences
Scope Impact Likelihood
Other Reduce Reliability
Demonstrative Examples
Example 1:
In the following Java example, the code catches an ArithmeticException.
CWE Version 4.14
CWE-1071: Empty Code Block
CWE-1071: Empty Code Block