mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
fix that js/file-system-race could have FPs related to loops
This commit is contained in:
@@ -106,7 +106,7 @@ predicate useAfterCheck(FileCheck check, FileUse use) {
|
||||
)
|
||||
)
|
||||
or
|
||||
check.getBasicBlock().getASuccessor+() = use.getBasicBlock()
|
||||
check.getBasicBlock().(ReachableBasicBlock).strictlyDominates(use.getBasicBlock())
|
||||
}
|
||||
|
||||
from FileCheck check, FileUse use
|
||||
|
||||
@@ -41,3 +41,8 @@ const filePath3 = createFile();
|
||||
if (fs.existsSync(filePath3)) {
|
||||
fs.readFileSync(filePath3); // OK - a read after an existence check is OK
|
||||
}
|
||||
|
||||
const filePath4 = createFile();
|
||||
while(Math.random() > 0.5) {
|
||||
fs.open(filePath4); // OK - it is only ever opened here.
|
||||
}
|
||||
Reference in New Issue
Block a user