openai/codex · error · anyhow::Error

runner frame length overflow

Error message

runner frame length overflow

What it means

Arithmetic overflow guard: the 4-byte little-endian frame length read from the runner pipe plus the 4-byte header would overflow usize. In practice this means a corrupted or malicious frame length (near u32::MAX) was received, indicating a garbled or untrusted pipe stream.

Solutions

  1. Reject the frame and tear down the pipe connection — the stream is corrupt
  2. Validate the runner executable and pipe endpoint to rule out a spoofed/misbehaving runner
  3. Cap frame_len against a sane maximum before allocating
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs:472 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/98c9bf20f37993d4. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs:472

                len_buf.as_mut_ptr() as *mut c_void,
                len_buf.len() as u32,
                &mut bytes_read,
                &mut total_available,
                ptr::null_mut(),
            )
        };
        if ok == 0 {
            let err = unsafe { GetLastError() } as i32;
            return Err(anyhow::anyhow!(
                "PeekNamedPipe failed while waiting for spawn_ready: {err}"
            ));
        }

        if bytes_read == len_buf.len() as u32 {
            let frame_len = u32::from_le_bytes(len_buf) as usize;
            let total_len = frame_len
                .checked_add(len_buf.len())
                .ok_or_else(|| anyhow::anyhow!("runner frame length overflow"))?;
            if total_available as usize >= total_len {
                return Ok(());
            }
        }

        if Instant::now() >= deadline {
            return Err(anyhow::anyhow!(
                "timed out after {}ms waiting for runner spawn_ready",
                timeout.as_millis()
            ));
        }

        std::thread::sleep(RUNNER_SPAWN_READY_POLL_INTERVAL);
    }
}

#[cfg(test)]
mod tests {

View on GitHub (pinned to 339751715c)