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

API: Functions are accepting nan, inf and infinity as "valid" number #4408

Open
Seadragon91 opened this issue Oct 1, 2019 · 0 comments

Comments

@Seadragon91
Copy link
Contributor

@Seadragon91 Seadragon91 commented Oct 1, 2019

Expected behavior

This should throw a lua stacktrace about invalid number.

Actual behavior

It's accepted.

Steps to reproduce the behavior

print(tonumber("nan"))
print(tonumber("inf"))
print(tonumber("infinity"))

Prints nan, inf and inf.

This can be also used in classes like Vector3i

local vec = Vector3i("nan", "inf", "infinity")
print(vec.x, vec.y, vec.z)

Prints -2147483648 on my system for all three numbers.

It's also possible to use them in the teleport command and doing this will crash your server:

/tp nan nan nan
/tp inf inf inf
@Seadragon91 Seadragon91 changed the title API: Functions are accepting nan, inf or infinity as "valid" number API: Functions are accepting nan, inf and infinity as "valid" number Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.