yaegi icon indicating copy to clipboard operation
yaegi copied to clipboard

`interp/type.go` can return a `nil` value (and no error, either) in `nodetype2`, which causes a panic

Open theclapp opened this issue 1 year ago • 0 comments

The following program sample.go triggers an unexpected result

n/a

Expected result

Error

Got

panic

Yaegi Version

381e045

Additional Notes

I'm having a hard time reproducing this at the moment, but the t == nil line in the below snippet from interp/type.go allows returning a nil value from nodetype2, which lots of places use without checking if it's nil (including right inside nodetype2), which causes a panic:

https://github.com/traefik/yaegi/blob/381e045966b079ca0ac364ba111fcb603226a74b/interp/type.go#L1119-L1127

I suspect that me hitting this case was a result of using Yaegi incorrectly (possibly from using ImportUsed but not actually importing those packages in the Eval'ed code), which I'm not doing any more, which is why I'm not seeing it, but I feel like the t == nil case should clearly at least return an error.

theclapp avatar May 21 '24 15:05 theclapp