STR34-C
: Do not consider integer type aliases in templates
#576
Labels
Difficulty-Medium
A false positive or false negative report which is expected to take 1-5 days effort to address
false positive/false negative
An issue related to observed false positives or false negatives.
Impact-Medium
Standard-CERT-C
user-report
Issue reported by an end user of CodeQL Coding Standards
Affected rules
STR34-C
Description
This query identifies conversions from signed
char
s to larger signed integers. This is a C rule, however it is part of the collection of C rules that can be applied to C++. In the case of C++, we observe potential false positives where such conversions happen in a template.This is because the query usually only reports cases where
char
orsigned char
are directly referenced. This is to avoid flagging code using typedefs ofchar
which are intended to be used integer types, not char types. For example, it's common forint8_t
to be typedef'd tochar
, and the rule wouldn't apply in this case because there's no developer confusion over the conversion. However, in template instantiations we see the fully resolved types, which means we would flag conversions if they occur in the template.Example
The text was updated successfully, but these errors were encountered: