Skip to content

Commit 52e3a9d

Browse files
authored
Merge pull request #324 from github/lcartey/fix-query-suppression-ids
Fix exclusion ids for a number of rules
2 parents 8e6744b + dc64dc8 commit 52e3a9d

6 files changed

+12
-7
lines changed

c/misra/src/rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import semmle.code.cpp.models.interfaces.Deallocation
2323

2424
from Expr e, string type
2525
where
26-
not isExcluded(e, BannedPackage::memoryAllocDeallocFunctionsOfStdlibhUsedQuery()) and
26+
not isExcluded(e, BannedPackage::stdLibDynamicMemoryAllocationUsedQuery()) and
2727
(
2828
e.(FunctionCall).getTarget().(AllocationFunction).requiresDealloc() and
2929
type = "allocation"

c/misra/src/rules/RULE-11-4/ConversionBetweenPointerToObjectAndIntegerType.ql

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ import codingstandards.c.Pointers
1717

1818
from CStyleCast cast, Type typeFrom, Type typeTo
1919
where
20-
not isExcluded(cast, Pointers1Package::castBetweenObjectPointerAndDifferentObjectTypeQuery()) and
20+
not isExcluded(cast, Pointers1Package::conversionBetweenPointerToObjectAndIntegerTypeQuery()) and
2121
typeFrom = cast.getExpr().getUnderlyingType() and
2222
typeTo = cast.getUnderlyingType() and
2323
[typeFrom, typeTo] instanceof IntegralType and
2424
[typeFrom, typeTo] instanceof PointerToObjectType and
2525
not isNullPointerConstant(cast.getExpr())
26-
select cast,
27-
"Cast performed between a pointer to object type and a pointer to an integer type."
26+
select cast, "Cast performed between a pointer to object type and a pointer to an integer type."

c/misra/src/rules/RULE-21-6/StandardLibraryInputoutputFunctionsUsed.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private string wcharInputOutput() {
4040

4141
from FunctionCall fc, Function f
4242
where
43-
not isExcluded(fc, BannedPackage::standardHeaderFileUsedSignalhQuery()) and
43+
not isExcluded(fc, BannedPackage::standardLibraryInputoutputFunctionsUsedQuery()) and
4444
fc.getTarget() = f and
4545
(
4646
f.getName() = stdInputOutput() and

c/misra/src/rules/RULE-21-9/BsearchAndQsortOfStdlibhUsed.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import codingstandards.c.misra
1717

1818
from FunctionCall fc, Function f
1919
where
20-
not isExcluded(fc, BannedPackage::terminationFunctionsOfStdlibhUsedQuery()) and
20+
not isExcluded(fc, BannedPackage::bsearchAndQsortOfStdlibhUsedQuery()) and
2121
f = fc.getTarget() and
2222
f.getName() = ["qsort", "bsearch"] and
2323
f.getFile().getBaseName() = "stdlib.h"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
* A number of rules had the wrong query ids attached for deviation purposes. This means they could not be deviated against using the correct ID, but could be incidentally suppressed when deviating a different rule. We have fixed this behavior for the following rules:
2+
- `RULE-11-4`
3+
- `DIR-4-12`
4+
- `RULE-21-6`
5+
- `RULE-21-9`
6+
- `MEM51-CPP`

cpp/cert/src/rules/MEM51-CPP/ProperlyDeallocateDynamicallyAllocatedResources.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ predicate matching(string allocKind, string deleteKind) {
2626

2727
from Expr alloc, Expr free, Expr freed, string allocKind, string deleteKind
2828
where
29-
not isExcluded(freed, FreedPackage::newDeleteArrayMismatchQuery()) and
29+
not isExcluded(freed, AllocationsPackage::properlyDeallocateDynamicallyAllocatedResourcesQuery()) and
3030
allocReaches(freed, alloc, allocKind) and
3131
freeExprOrIndirect(free, freed, deleteKind) and
3232
not matching(allocKind, deleteKind)

0 commit comments

Comments
 (0)