Skip to content

Fix IL floating point to int conversion out-of-bounds bug - #6670

Open
DRJ-YDV wants to merge 2 commits into
rizinorg:devfrom
DRJ-YDV:fix-6464
Open

Fix IL floating point to int conversion out-of-bounds bug#6670
DRJ-YDV wants to merge 2 commits into
rizinorg:devfrom
DRJ-YDV:fix-6464

Conversation

@DRJ-YDV

@DRJ-YDV DRJ-YDV commented Aug 18, 2026

Copy link
Copy Markdown

Fix IL floating point to int conversion out-of-bounds bug

This PR resolves an issue on x86 where float-to-int operations casting out-of-bounds inputs like Infinity, NaN, or extremely large numbers incorrectly evaluate to 0 instead of the architecture-expected indefinite value (0x80000000).

I've extended the \F2INT\ and \F2SINT\ IL macros and the associated internal converter to explicitly accept an out-of-bounds behavior configuration parameter. This allows each architecture lifter to specify how it expects out-of-bounds conversions to behave. For example:

  • x86 lifters now use \RZ_FLOAT_CAST_OOB_INDEFINITE\ to correctly produce 0x80000000
  • ARM lifters use \RZ_FLOAT_CAST_OOB_SATURATE\ to correctly saturate at integer min/max limits
  • Other architectures default to \RZ_FLOAT_CAST_OOB_TRUNCATE\ to preserve existing behavior until their precise quirks are verified.

Fixes #6464

This introduces out-of-bounds (OOB) behavior specification for
float to int IL conversions (F2SINT / F2INT) to correctly handle
architecture specific behaviors when casting out-of-bounds floats.
Specifically fixes the x86 issue where float casts of Inf/NaN or
large numbers returned 0 instead of the indefinite value (0x80000000)
as expected by the x86 specification.

Fixes rizinorg#6464

Co-authored-by agent: Antigravity/Gemini
Co-authored-by agent: Antigravity/Gemini 3.1 Pro (High)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x86 IL: Float -> int conversions are wrong for special values (e.g. +∞)

1 participant