forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduledThreadPoolExecutorZeroThread.ql
More file actions
35 lines (32 loc) · 1.18 KB
/
ScheduledThreadPoolExecutorZeroThread.ql
File metadata and controls
35 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* @id java/javautilconcurrentscheduledthreadpoolexecutor
* @name Zero threads set for `java.util.concurrent.ScheduledThreadPoolExecutor`
* @description Setting `java.util.concurrent.ScheduledThreadPoolExecutor` to have 0 threads serves
* no purpose and may indicate programmer error.
* @kind problem
* @precision very-high
* @problem.severity recommendation
* @tags quality
* reliability
* correctness
* concurrency
*/
import java
import semmle.code.java.dataflow.DataFlow
/**
* A `Call` that has the ability to set or modify the `corePoolSize` of the `java.util.concurrent.ScheduledThreadPoolExecutor` type.
*/
class Sink extends Call {
Sink() {
this.getCallee()
.hasQualifiedName("java.util.concurrent", "ThreadPoolExecutor", "setCorePoolSize") or
this.getCallee()
.hasQualifiedName("java.util.concurrent", "ScheduledThreadPoolExecutor",
"ScheduledThreadPoolExecutor")
}
}
from IntegerLiteral zero, Sink set
where
DataFlow::localFlow(DataFlow::exprNode(zero), DataFlow::exprNode(set.getArgument(0))) and
zero.getIntValue() = 0
select set, "ScheduledThreadPoolExecutor.corePoolSize is set to have 0 threads."