github-vet / bots

Bots for running analysis on GitHub's public Go repositories and crowdsourcing their classification.
MIT License
1 stars 1 forks source link

Handle method calls on pointer receivers #117

Open kalexmills opened 3 years ago

kalexmills commented 3 years ago

Another way a pointer from a range loop can be passed into a function is via a pointer receiver. Currently this is ignored, but it can also lead to issues in cases where the pointer receiver is written elsewhere in memory or used inside a goroutine.

kalexmills commented 3 years ago

This will require: 1) Inspecting for SelectorExpr and doing (a very simple) name resolution to find pointer arguments passed into functions on the LHS of the . 2) Modifying the callgraph to include functions with pointer receivers as part of the the signature of function declarations. 3) Modify pointerescapes to know whether a CallExpr is contained within a SelectorExpr, and look up the signature accordingly.

It is still the case that no type-checking needs to be performed here.