Skip to content

Issue in arm_div_int64_to_int32(int64_t num, int32_t den): There may be a risk of overflow when the num is 0x800000000000000 #287

@Angerla

Description

@Angerla
Image

For the above code, if the incoming data is 0x800000000000000, there seems to be a risk of overflow. In some compilers, the data of (int64_t)LONG_MIN may be converted to -2147483648:
Image

When the incoming data is 0x800000000000000 it will go to the processing of -num and the number of -(-9,223,372,036,854,775,808) may be overflow in the range of int64_t (-9,223,372,036,854,775,808~9,223,372,036,854,775,807). And this might lead to the generation of undefined behaviors of the compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DONEIssue done but not yet closedbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions