Pointer dereference with tainted offset
Offset is from an unsecure source and dereference might be out of bounds
Description
This defect occurs when a pointer dereference uses an offset variable from an unknown or unsecure source.
This check focuses on dynamically allocated buffers. For static
buffer offsets, see Array access with tainted index
.
Risk
The index might be outside the valid array range. If the tainted index is outside the array range, it can cause:
Buffer underflow/underwrite, or writing to memory before the beginning of the buffer.
Buffer overflow, or writing to memory after the end of a buffer.
Over reading a buffer, or accessing memory after the end of the targeted buffer.
Under-reading a buffer, or accessing memory before the beginning of the targeted buffer.
An attacker can use an invalid read or write to compromise your program.
Fix
Validate the index before you use the variable to access the pointer. Check to make sure that the variable is inside the valid range and does not overflow.
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_PTR_OFFSET |
Impact: Low |
Version History
Introduced in R2015b
See Also
Array access with tainted index
| Use of tainted pointer
| 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