зеркало из https://github.com/github/codeql.git
Merge pull request #4532 from geoffw0/wrongtypeformaterr
C++: Harden queries against ErroneousType
This commit is contained in:
Коммит
90c027f291
|
@ -0,0 +1,2 @@
|
|||
lgtm,codescanning
|
||||
* The `cpp/wrong-type-format-argument` and `cpp/non-portable-printf` queries have been hardened so that they do not produce nonsensical results on databases that contain errors (specifically the `ErroneousType`).
|
|
@ -155,7 +155,8 @@ where
|
|||
not actual.getUnspecifiedType().(IntegralType).getSize() = sizeof_IntType()
|
||||
) and
|
||||
not arg.isAffectedByMacro() and
|
||||
not arg.isFromUninstantiatedTemplate(_)
|
||||
not arg.isFromUninstantiatedTemplate(_) and
|
||||
not actual.getUnspecifiedType() instanceof ErroneousType
|
||||
select arg,
|
||||
"This argument should be of type '" + expected.getName() + "' but is of type '" +
|
||||
actual.getUnspecifiedType().getName() + "'"
|
||||
|
|
|
@ -88,7 +88,8 @@ where
|
|||
not arg.isAffectedByMacro() and
|
||||
size32 = ilp32.paddedSize(actual) and
|
||||
size64 = lp64.paddedSize(actual) and
|
||||
size64 != size32
|
||||
size64 != size32 and
|
||||
not actual instanceof ErroneousType
|
||||
select arg,
|
||||
"This argument should be of type '" + expected.getName() + "' but is of type '" + actual.getName()
|
||||
+ "' (which changes size from " + size32 + " to " + size64 + " on 64-bit systems)."
|
||||
|
|
Загрузка…
Ссылка в новой задаче