Cast to MethodCallNode before calling getReceiver()

This is not required, because getReceiver is still defined on CallNode,
but is done for consistency.
This commit is contained in:
Owen Mansel-Chan
2023-07-19 10:36:36 +01:00
parent de8794e9ba
commit a3ba74a6a6
12 changed files with 31 additions and 28 deletions

View File

@@ -90,7 +90,7 @@ predicate isWritableFileHandle(DataFlow::Node source, DataFlow::CallNode call) {
/**
* Holds if `os.File.Close` is called on `sink`.
*/
predicate isCloseSink(DataFlow::Node sink, DataFlow::CallNode closeCall) {
predicate isCloseSink(DataFlow::Node sink, DataFlow::MethodCallNode closeCall) {
// find calls to the os.File.Close function
closeCall = any(CloseFileFun f).getACall() and
// that are unhandled
@@ -115,7 +115,7 @@ predicate isCloseSink(DataFlow::Node sink, DataFlow::CallNode closeCall) {
* Holds if `os.File.Sync` is called on `sink` and the result of the call is neither
* deferred nor discarded.
*/
predicate isHandledSync(DataFlow::Node sink, DataFlow::CallNode syncCall) {
predicate isHandledSync(DataFlow::Node sink, DataFlow::MethodCallNode syncCall) {
// find a call of the `os.File.Sync` function
syncCall = any(SyncFileFun f).getACall() and
// match the sink with the object on which the method is called