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

Perhaps nan/inf protection should be more comprehensive #1906

Open
sprunk opened this issue Jan 19, 2025 · 0 comments
Open

Perhaps nan/inf protection should be more comprehensive #1906

sprunk opened this issue Jan 19, 2025 · 0 comments

Comments

@sprunk
Copy link
Collaborator

sprunk commented Jan 19, 2025

a87d53b added nan/inf protection to luaL_checknumber and lua_tofloat.

  • what about lua_tonumber? It also produces floats and seems to be used a lot but didn't get protection.
  • should functions that produce an int also get protection? In Lua, the number type is a float and the engine does a cast when it wants an int. Isn't this UB if the float was nan/inf? Can it be UB or implementation defined if the float was outside int bounds? This one is less about crashes (since all ints are "valid") and more about desync. I assume it's handled by all of our usual SSE/streflop/etc magic that prevents all the other ways floats could desync but perhaps it's worth checking either way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant