-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'elhouha-WFPContractQueries' of https://github.com/houha…
…2/Windows-Driver-Developer-Supplemental-Tools into elhouha-WFPContractQueries
- Loading branch information
Showing
11 changed files
with
118 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/drivers/general/queries/MultithreadedAVCondition/MultithreadedAVCondition.qhelp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd"> | ||
<qhelp> | ||
<overview> | ||
<p> | ||
This warning indicates that a thread has potential to access deleted objects if preempted. Unlike the Code Analysis version of this query, this query does not currently verify the use of any synchronization mechanisms, so it may produce false positives. | ||
</p> | ||
</overview> | ||
<recommendation> | ||
<p> | ||
There should be no access to a reference-counted object after the reference count is at zero | ||
</p> | ||
</recommendation> | ||
<example> | ||
<p> | ||
In this example, m_cRef is a member of this. A thread T1 executes the if condition, decrements m_cRef to 1, and is then preempted. Another thread T2 executes the if condition, decrements m_cRef to 0, executes the if body (where this is deleted), and returns NULL. | ||
</p> | ||
<sample language="c"><![CDATA[ | ||
ULONG Release_bad() | ||
{ | ||
if (0 == InterlockedDecrement(&m_cRef)) | ||
{ | ||
delete this; | ||
return NULL; | ||
} | ||
/* this.m_cRef isn't thread safe */ | ||
return m_cRef; | ||
} | ||
]]> | ||
</sample> | ||
<p> | ||
The following code does not reference any heap memory after the object is deleted. | ||
</p> | ||
<sample language="c"><![CDATA[ | ||
ULONG CObject::Release() | ||
{ | ||
ASSERT(0 != m_cRef); | ||
ULONG cRef = InterlockedDecrement(&m_cRef); | ||
if (0 == cRef) | ||
{ | ||
delete this; | ||
return NULL; | ||
} | ||
return cRef; | ||
} | ||
]]> | ||
</sample> | ||
</example> | ||
<references> | ||
<li> | ||
<a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/28616-multithreaded-av-condition"> | ||
Warning C28616 | ||
</a> | ||
</li> | ||
</references> | ||
</qhelp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
src/drivers/general/queries/MultithreadedAVCondition/MultithreadedAVCondition.qlhelp
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.