Skip to content

Infinite loop when evaluating ((-2**63/-1)) #789

@oliwer

Description

@oliwer

Using Korn Shell Version AJM 93u+m/1.0.8 2024-01-01 on Linux amd64, the following command causes ksh to run into an infinite loop. I had to kill -9 it:

echo $((-2**63/-1))

I ran a quick gdb, and it seems this line is the culprit:

num = U2F((Sfulong_t)(sp[-1]) / (Sfulong_t)(num));

The variable sp[-1] holds a negative long double (-9223372036854775808) which we are casting to an unsigned long. Looks like a similar issue to #770

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions