#5481·boa

Panic: i32::MIN % -1 remainder overflow

Author: domenukkCreated Aug 18, 2026Updated Aug 30, 2026

Describe the bug Panic / Unreachable when running

javascript
(-2147483648 | 0) % (-1 | 0)

Expected behavior Not crash

boa_engine-0.21.1/src/value/operations.rs:157

// Line 150-161:
pub fn rem(&self, other: &Self, context: &mut Context) -> JsResult<Self> {
    Ok(match (self.variant(), other.variant()) {
        // Fast path:
        (JsVariant::Integer32(x), JsVariant::Integer32(y)) => {
            if y == 0 {
                Self::nan()
            } else {
                match x % y {  // ← LINE 157: PANICS when x=i32::MIN, y=-1
                    rem if rem == 0 && x < 0 => Self::new(-0.0),
                    rem => Self::new(rem),
                }
            }
        }