Skip to content

Infinite loop in num_pow #3677

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

Closed
clayton-shopify opened this issue May 30, 2017 · 0 comments
Closed

Infinite loop in num_pow #3677

clayton-shopify opened this issue May 30, 2017 · 0 comments

Comments

@clayton-shopify
Copy link
Contributor

The following input demonstrates an infinite loop:

1**-1

The problem was introduced in 06c4933. Since -1 >> 1 == -1, exp never reaches zero:

mruby/src/numeric.c

Lines 72 to 73 in ef11584

exp >>= 1;
if (exp == 0) break;

This issue was reported by https://hackerone.com/shikchen

@matz matz closed this as completed in 877f9d0 May 31, 2017
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