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

Potential infinite loop in Real.hpp #39

Open
Thiesius opened this issue Nov 16, 2021 · 0 comments
Open

Potential infinite loop in Real.hpp #39

Thiesius opened this issue Nov 16, 2021 · 0 comments
Assignees

Comments

@Thiesius
Copy link

There is a possibility of infinite loop in Real.hpp. if the first part of the condition (first_byte & 0xF0) == 0 evaluates as true and exponent is bigger than 0, then for obvious reasons (exponent -= 0) loop never ends.

   /* Mantissa is too small - shift left up to 4 bits */
    int          shift      = 8;
    unsigned int first_byte = double_bytes[1];

    /* Adapt exponent */
    while ((first_byte & 0xF0) == 0 && exponent > (8 - shift))
    {
        exponent -= 8 - shift;
    }
@Samuel-Tyler Samuel-Tyler self-assigned this Nov 21, 2021
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

2 participants