1154
Mapped Taxonomy Name Node ID Fit Mapped Node Name
CERT C Secure Coding EXP46-C CWE More
Abstract
Do not use a bitwise operator with a
Boolean-like operand
Software Fault Patterns SFP1 Glitch in Computation
References
[REF-18]Secure Software, Inc.. "The CLASP Application Security Process". 2005. < https://
cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf >.
[REF-62]Mark Dowd, John McDonald and Justin Schuh. "The Art of Software Security
Assessment". 1st Edition. 2006. Addison Wesley.
[REF-1377]"csr_regile.sv line 938". 2021. < https://github.com/HACK-EVENT/hackatdac19/
blob/57e7b2109c1ea2451914878df2e6ca740c2dcf34/src/csr_regfile.sv#L938 >.2023-12-13.
[REF-1378]"Fix for csr_regfile.sv line 938". 2021. < https://github.com/HACK-EVENT/hackatdac19/
blob/a7b61209e56c48eec585eeedea8413997ec71e4a/src/csr_regfile.sv#L938C31-L938C56
>.2023-12-13.
CWE-481: Assigning instead of Comparing
Weakness ID : 481
Structure : Simple
Abstraction : Variant
Description
The code uses an operator for assignment when the intention was to perform a comparison.
Extended Description
In many languages the compare statement is very close in appearance to the assignment
statement and are often confused. This bug is generally the result of a typo and usually causes
obvious problems with program execution. If the comparison is in an if statement, the if statement
will usually evaluate the value of the right-hand side of the predicate.
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 480 Use of Incorrect Operator 1150
CanPrecede 697 Incorrect Comparison 1530
Applicable Platforms
Language : C (Prevalence = Undetermined)
Language : C++ (Prevalence = Undetermined)
Language : Java (Prevalence = Undetermined)
Language : C# (Prevalence = Undetermined)
Likelihood Of Exploit
Low
Common Consequences
CWE Version 4.14
CWE-481: Assigning instead of Comparing
CWE-481: Assigning instead of Comparing