{"record":{"id":"98c9bf20f37993d4","repo":"openai/codex","slug":"runner-frame-length-overflow","errorCode":null,"errorMessage":"runner frame length overflow","messagePattern":"runner frame length overflow","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs","lineNumber":472,"sourceCode":"                len_buf.as_mut_ptr() as *mut c_void,\n                len_buf.len() as u32,\n                &mut bytes_read,\n                &mut total_available,\n                ptr::null_mut(),\n            )\n        };\n        if ok == 0 {\n            let err = unsafe { GetLastError() } as i32;\n            return Err(anyhow::anyhow!(\n                \"PeekNamedPipe failed while waiting for spawn_ready: {err}\"\n            ));\n        }\n\n        if bytes_read == len_buf.len() as u32 {\n            let frame_len = u32::from_le_bytes(len_buf) as usize;\n            let total_len = frame_len\n                .checked_add(len_buf.len())\n                .ok_or_else(|| anyhow::anyhow!(\"runner frame length overflow\"))?;\n            if total_available as usize >= total_len {\n                return Ok(());\n            }\n        }\n\n        if Instant::now() >= deadline {\n            return Err(anyhow::anyhow!(\n                \"timed out after {}ms waiting for runner spawn_ready\",\n                timeout.as_millis()\n            ));\n        }\n\n        std::thread::sleep(RUNNER_SPAWN_READY_POLL_INTERVAL);\n    }\n}\n\n#[cfg(test)]\nmod tests {","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs#L454-L490","documentation":"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.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs:472 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject the frame and tear down the pipe connection — the stream is corrupt","Validate the runner executable and pipe endpoint to rule out a spoofed/misbehaving runner","Cap frame_len against a sane maximum before allocating"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}