Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
theclapp opened this issue May 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@theclapp
Copy link
Contributor

theclapp commented May 21, 2024

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:

yaegi/interp/type.go

Lines 1119 to 1127 in 381e045

switch {
case t == nil:
case t.name != "" && t.path != "":
t.str = t.path + "." + t.name
case t.cat == nilT:
t.str = "nil"
}
return t, err

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.

@ldez ldez added the bug Something isn't working label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants