Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix exclusion ids for a number of rules #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions 6 change_notes/2023-07-5-fix-suppression-ids.md
Original file line number Diff line number Diff line change
@@ -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`
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.