File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
python/ql/lib/semmle/python/frameworks Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -17,22 +17,26 @@ private module Numpy {
17
17
/**
18
18
* A call to `numpy.load`
19
19
* See https://pypi.org/project/numpy/
20
- *
21
20
*/
22
- private class PandasReadPickleCall extends Decoding:: Range , DataFlow:: CallCfgNode {
23
- PandasReadPickleCall ( ) {
24
- this = API:: moduleImport ( "numpy" ) .getMember ( "load" ) .getACall ( ) and
25
- this .getArgByName ( "allow_pickle" ) .asExpr ( ) = any ( True t )
26
- }
27
-
28
- override predicate mayExecuteInput ( ) { any ( ) }
21
+ private class NumpyLoadCall extends Decoding:: Range , API:: CallNode {
22
+ NumpyLoadCall ( ) { this = API:: moduleImport ( "numpy" ) .getMember ( "load" ) .getACall ( ) }
29
23
30
- override DataFlow:: Node getAnInput ( ) {
31
- result in [ this .getArg ( 0 ) , this .getArgByName ( "filename" ) ]
24
+ override predicate mayExecuteInput ( ) {
25
+ this .getParameter ( 2 , "allow_pickle" )
26
+ .getAValueReachingSink ( )
27
+ .asExpr ( )
28
+ .( ImmutableLiteral )
29
+ .booleanValue ( ) = true
32
30
}
33
31
32
+ override DataFlow:: Node getAnInput ( ) { result = this .getParameter ( 0 , "filename" ) .asSink ( ) }
33
+
34
34
override DataFlow:: Node getOutput ( ) { result = this }
35
35
36
- override string getFormat ( ) { result = "numpy" }
36
+ override string getFormat ( ) {
37
+ result = "numpy"
38
+ or
39
+ this .mayExecuteInput ( ) and result = "pickle"
40
+ }
37
41
}
38
42
}
You can’t perform that action at this time.
0 commit comments