diff --git a/c/misra/src/rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql b/c/misra/src/rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql index a759a631b7..dc1e21c97a 100644 --- a/c/misra/src/rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql +++ b/c/misra/src/rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql @@ -23,7 +23,7 @@ import semmle.code.cpp.models.interfaces.Deallocation from Expr e, string type where - not isExcluded(e, BannedPackage::memoryAllocDeallocFunctionsOfStdlibhUsedQuery()) and + not isExcluded(e, BannedPackage::stdLibDynamicMemoryAllocationUsedQuery()) and ( e.(FunctionCall).getTarget().(AllocationFunction).requiresDealloc() and type = "allocation" diff --git a/c/misra/src/rules/RULE-11-4/ConversionBetweenPointerToObjectAndIntegerType.ql b/c/misra/src/rules/RULE-11-4/ConversionBetweenPointerToObjectAndIntegerType.ql index 4071cf63b5..263545dc1f 100644 --- a/c/misra/src/rules/RULE-11-4/ConversionBetweenPointerToObjectAndIntegerType.ql +++ b/c/misra/src/rules/RULE-11-4/ConversionBetweenPointerToObjectAndIntegerType.ql @@ -17,11 +17,10 @@ import codingstandards.c.Pointers from CStyleCast cast, Type typeFrom, Type typeTo where - not isExcluded(cast, Pointers1Package::castBetweenObjectPointerAndDifferentObjectTypeQuery()) and + not isExcluded(cast, Pointers1Package::conversionBetweenPointerToObjectAndIntegerTypeQuery()) and typeFrom = cast.getExpr().getUnderlyingType() and typeTo = cast.getUnderlyingType() and [typeFrom, typeTo] instanceof IntegralType and [typeFrom, typeTo] instanceof PointerToObjectType and not isNullPointerConstant(cast.getExpr()) -select cast, - "Cast performed between a pointer to object type and a pointer to an integer type." +select cast, "Cast performed between a pointer to object type and a pointer to an integer type." diff --git a/c/misra/src/rules/RULE-21-6/StandardLibraryInputoutputFunctionsUsed.ql b/c/misra/src/rules/RULE-21-6/StandardLibraryInputoutputFunctionsUsed.ql index 8976e87c2f..6ef8c84cfe 100644 --- a/c/misra/src/rules/RULE-21-6/StandardLibraryInputoutputFunctionsUsed.ql +++ b/c/misra/src/rules/RULE-21-6/StandardLibraryInputoutputFunctionsUsed.ql @@ -40,7 +40,7 @@ private string wcharInputOutput() { from FunctionCall fc, Function f where - not isExcluded(fc, BannedPackage::standardHeaderFileUsedSignalhQuery()) and + not isExcluded(fc, BannedPackage::standardLibraryInputoutputFunctionsUsedQuery()) and fc.getTarget() = f and ( f.getName() = stdInputOutput() and diff --git a/c/misra/src/rules/RULE-21-9/BsearchAndQsortOfStdlibhUsed.ql b/c/misra/src/rules/RULE-21-9/BsearchAndQsortOfStdlibhUsed.ql index e442120ffc..b446b7f3f6 100644 --- a/c/misra/src/rules/RULE-21-9/BsearchAndQsortOfStdlibhUsed.ql +++ b/c/misra/src/rules/RULE-21-9/BsearchAndQsortOfStdlibhUsed.ql @@ -17,7 +17,7 @@ import codingstandards.c.misra from FunctionCall fc, Function f where - not isExcluded(fc, BannedPackage::terminationFunctionsOfStdlibhUsedQuery()) and + not isExcluded(fc, BannedPackage::bsearchAndQsortOfStdlibhUsedQuery()) and f = fc.getTarget() and f.getName() = ["qsort", "bsearch"] and f.getFile().getBaseName() = "stdlib.h" diff --git a/change_notes/2023-07-5-fix-suppression-ids.md b/change_notes/2023-07-5-fix-suppression-ids.md new file mode 100644 index 0000000000..44de5dd607 --- /dev/null +++ b/change_notes/2023-07-5-fix-suppression-ids.md @@ -0,0 +1,6 @@ + * 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: + - `RULE-11-4` + - `DIR-4-12` + - `RULE-21-6` + - `RULE-21-9` + - `MEM51-CPP` \ No newline at end of file diff --git a/cpp/cert/src/rules/MEM51-CPP/ProperlyDeallocateDynamicallyAllocatedResources.ql b/cpp/cert/src/rules/MEM51-CPP/ProperlyDeallocateDynamicallyAllocatedResources.ql index 0cc7779a46..5854b169f2 100644 --- a/cpp/cert/src/rules/MEM51-CPP/ProperlyDeallocateDynamicallyAllocatedResources.ql +++ b/cpp/cert/src/rules/MEM51-CPP/ProperlyDeallocateDynamicallyAllocatedResources.ql @@ -26,7 +26,7 @@ predicate matching(string allocKind, string deleteKind) { from Expr alloc, Expr free, Expr freed, string allocKind, string deleteKind where - not isExcluded(freed, FreedPackage::newDeleteArrayMismatchQuery()) and + not isExcluded(freed, AllocationsPackage::properlyDeallocateDynamicallyAllocatedResourcesQuery()) and allocReaches(freed, alloc, allocKind) and freeExprOrIndirect(free, freed, deleteKind) and not matching(allocKind, deleteKind)