Too many va_arg calls for current argument list
Number of calls to va_arg
exceeds number of arguments passed
to variadic function
Description
This defect
occurs when the number of calls to va_arg
exceeds the number of
arguments passed to the corresponding variadic function. The analysis raises a defect
only when the variadic function is called.
Too many va_arg calls for current argument list does not raise a defect when:
The number of calls to
va_arg
inside the variadic function is indeterminate. For example, if the calls are from an external source.The
va_list
used inva_arg
is invalid.
Risk
When you call va_arg
and there is no next argument available in
va_list
, the behavior is undefined. The call to
va_arg
might corrupt data or return an unexpected
result.
Fix
Ensure that you pass the correct number of arguments to the variadic function.
Examples
Result Information
Group: Programming |
Language: C | C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax:
TOO_MANY_VA_ARG_CALLS |
Impact: Medium |
Version History
Introduced in R2018a
See Also
Find defects (-checkers)
| Invalid va_list argument
| Incorrect data
type passed to va_arg
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)