Skip to content

Commit 8f84320

Browse files
authored
Merge pull request #7493 from MrAnno/relax-ambiguously-signed-bit-field
C++: relax ambiguously-signed-bit-field by allowing GLib's gboolean
2 parents bfb573c + e31185f commit 8f84320

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cpp/ql/src/Likely Bugs/AmbiguouslySignedBitField.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ where
2626
// At least for C programs on Windows, BOOL is a common typedef for a type
2727
// representing BoolType.
2828
not bf.getType().hasName("BOOL") and
29+
// GLib's gboolean is a typedef for a type representing BoolType.
30+
not bf.getType().hasName("gboolean") and
2931
// If this is true, then there cannot be unsigned sign extension or overflow.
3032
not bf.getDeclaredNumBits() = bf.getType().getSize() * 8 and
3133
not bf.isAnonymous() and
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added exception for GLib's gboolean to cpp/ambiguously-signed-bit-field.
5+
This change reduces the number of false positives in the query.

0 commit comments

Comments
 (0)