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

randFloat({ min: 0, max: 0 }) causes stack overflow #354

Closed
srmagura opened this issue Jun 1, 2023 · 2 comments · Fixed by #355
Closed

randFloat({ min: 0, max: 0 }) causes stack overflow #354

srmagura opened this issue Jun 1, 2023 · 2 comments · Fixed by #355

Comments

@srmagura
Copy link
Contributor

srmagura commented Jun 1, 2023

Is this a regression?

No

Description

Calling randFloat with the same value for the min and max results in infinite recursion.

Please provide a link to a minimal reproduction of the bug

https://github.com/srmagura/falso-rand-float-repro

Please provide the exception or error you saw

/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/seedrandom/seedrandom.js:58
  var prng = function() {
                     ^

RangeError: Maximum call stack size exceeded
    at prng (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/seedrandom/seedrandom.js:58:22)
    at n (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:236)
    at l (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:553)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115474)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115553)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115553)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115553)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115553)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115553)
    at e (/Users/srmagura/Documents/oss/bugs/falso-rand-float-repro/node_modules/@ngneat/falso/index.cjs.js:1:115553)

Node.js v18.15.0

Please provide the environment you discovered this bug in

macOS 13.3.1, Node 18.15.0

Anything else?

No response

Do you want to create a pull request?

Yes

@shaharkazaz
Copy link
Contributor

@srmagura I'm guessing this happens for every equal values right?
You are welcome to open a PR

@srmagura
Copy link
Contributor Author

srmagura commented Jun 1, 2023

Yes, it happens whenever the min and max are equal.

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

Successfully merging a pull request may close this issue.

2 participants