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 |
A character is specified with an octal or hexadecimal escape sequence whose value is too large to fit into the character type used.
This warning class is derived from a C/C++ parser warning.
| Class Name | Bad Character Value | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | style | ||||||||||||
| Mnemonic | PARSE.BAD.CV | ||||||||||||
| Categories |
|
||||||||||||
| Availability | Available for C and C++. |
||||||||||||
| Enabling | Checks for this warning class are enabled by default.
However, warning instances of this class that are issued as parser
errors (rather than parser warnings)
will be discarded
when using factory configuration settings.
To prevent these instances from being discarded, add the
following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Bad Character Value" WARNING_FILTER += discard class="Bad Character Value" |
#include <stddef.h> /* Comments on this file reflect a platform with 8-bit char and 32-bit wchar_t. * - If your platform has narrower character types you may see additional warnings with the same code. * - If your platform has wider character types you may see fewer warnings with the same code. */ char invalid_hex_char = '\x100'; /* 'Bad Character Value' warning issued here * - 0x100 does not fit in an 8-bit char */ char no_hex_char = 'h'; /* ok: no hex escape sequence */ char valid_hex_char = '\x006A'; /* ok: 0x6A fits in an 8-bit char */ wchar_t invalid_hex_wchar = L'\x100000000'; /* 'Bad Character Value' warning issued here * - 0x100000000 does not fit in a 32-bit wchar_t */ wchar_t valid_hex_wchar = L'\x100'; /* ok: 0x100 fits in a 32-bit wchar_t */ char valid_oct_char = '\0'; /* ok: 0 fits into an 8-bit char */ char invalid_oct_char = '\777'; /* 'Bad Character Value' warning issued here * - 0777 does not fit in an 8-bit char */ void myfunc(char *s); void call_myfunc(void){ myfunc("hello \x100"); /* 'Bad Character Value' warning issued here * - 0x100 does not fit in an 8-bit char */ myfunc("hello again"); /* ok: no hex escape sequences */ myfunc("hello yet again \x006A \x41"); /* ok: both 0x6A and 0x41 fit in an 8-bit char */ }
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.