Skip to content

Commit 179a7d5

Browse files
committed
C++: Handle 'wchar_t' types that may be defined as unsigned short in C. This brings back SAMATE results.
1 parent 9854ed4 commit 179a7d5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cpp/ql/src/Likely Bugs/Format/NonConstantFormat.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ predicate cannotContainString(Type t) {
4949
not unspecified instanceof WideCharType and
5050
not unspecified instanceof Char8Type and
5151
not unspecified instanceof Char16Type and
52-
not unspecified instanceof Char32Type
52+
not unspecified instanceof Char32Type and
53+
// C often defines `wchar_t` as `unsigned short`
54+
unspecified = any(ShortType short | not short.isUnsigned())
5355
|
5456
unspecified instanceof ArithmeticType or
5557
unspecified instanceof BuiltInType

0 commit comments

Comments
 (0)