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

Cannot calculate 1,000,000th Fibonacci number #3

Closed
tarcieri opened this issue Oct 3, 2011 · 5 comments
Closed

Cannot calculate 1,000,000th Fibonacci number #3

tarcieri opened this issue Oct 3, 2011 · 5 comments

Comments

@tarcieri
Copy link

tarcieri commented Oct 3, 2011

This crashes node-fib:

$ time curl localhost:3000/1000000
curl: (52) Empty reply from server

real    1m0.392s
user 0m0.006s
sys 0m0.004s

It appears it ran out of memory:

$ node app.js 
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory
@rbranson
Copy link

rbranson commented Oct 3, 2011

Looks to be a potential DoS vector.

@glenjamin
Copy link
Owner

I shall alert those intending to use this in production that there may be a security issue :)

@glenjamin
Copy link
Owner

While the new algorithm does support n=1000000, JavaScript's native number type does not.

@Incognito
Copy link

Woah woah woah, why are you closing this? Just use bignum. http://jsfromhell.com/classes/bignumber

@glenjamin glenjamin reopened this Oct 4, 2011
@glenjamin
Copy link
Owner

I've already spent far more time on this than I intended, pull requests for bignum support are welcome.

Had a cursory glance over that bignum library, it looks horrible!

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

4 participants