JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++


LANG.CAST.VARARG : Varargs Function Cast

Summary

A varargs function pointer is cast to another function pointer that has different parameters or return type.

Properties

Class Name Varargs Function Cast
Significance security
Mnemonic LANG.CAST.VARARG
Categories
AUTOSARC++14 AUTOSARC++14:M8-4-4 A function identifier shall either be used to call the function or it shall be preceded by &.
MisraC++2008 MisraC++2008:8-4-4 A function identifier shall either be used to call the function or it shall be preceded by &.
CWE CWE:704 Incorrect Type Conversion or Cast
JSF++ JSF++:183 Every possible measure should be taken to avoid type casting.
Availability Available for C and C++.
Enabling Checks for this warning class are enabled by default. To disable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Varargs Function Cast"

Example

typedef void (*va_t)(int, ...);
void E( int i, int j ) {}

int main( void ) {
  va_t va = (va_t)E;  /* 'Varargs Function Cast' warning issued here */

   va(1,2,3);
   return 42;
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.codesecure.com/.