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 {
1717 /**
1818 * A call to `numpy.load`
1919 * See https://pypi.org/project/numpy/
20- *
2120 */
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 ( ) }
2923
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
3230 }
3331
32+ override DataFlow:: Node getAnInput ( ) { result = this .getParameter ( 0 , "filename" ) .asSink ( ) }
33+
3434 override DataFlow:: Node getOutput ( ) { result = this }
3535
36- override string getFormat ( ) { result = "numpy" }
36+ override string getFormat ( ) {
37+ result = "numpy"
38+ or
39+ this .mayExecuteInput ( ) and result = "pickle"
40+ }
3741 }
3842}
You can’t perform that action at this time.
0 commit comments