Loop bounded with tainted value
Loop controlled by a value from an unsecure source
Description
This defect occurs when a loop is bounded by values obtained from unsecure sources.
Risk
A tainted value can cause over looping or infinite loops. Attackers can use this vulnerability to terminate your program or cause other unintended behavior.
Fix
Before starting the loop, validate unknown boundary and iterator values by validating their low bounds and high bounds. Execute the loop only when both the lower bound and upper bound of the tainted values are validated. Explicitly check that both the lower and upper bound of the tainted value is acceptable. Alternatively, saturate or clamp the tainted value.
Extend Checker
By default, Polyspace® assumes that data from external sources are tainted. See Sources of Tainting in a Polyspace Analysis. To consider any data
that does not originate in the current scope of Polyspace analysis as tainted, use the
command line option -consider-analysis-perimeter-as-trust-boundary
.
Examples
Result Information
Group: Tainted Data |
Language: C | C++ |
Default: Off |
Command-Line Syntax: TAINTED_LOOP_BOUNDARY |
Impact: Medium |
Version History
Introduced in R2015b
See Also
Array access with tainted index
| Pointer dereference with tainted offset
| Find defects
(-checkers)
| -consider-analysis-perimeter-as-trust-boundary
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)
- Sources of Tainting in a Polyspace Analysis
- Modify Default Behavior of Bug Finder Checkers