Skip to content

fix(render): unbounded headless surface allocation in gpu.rs (CR-RENDER-01) #345

Closed

Description

@Xuepoo

Priority: P1 | Area: render | Labels: fix,area:render,P1 | Milestone: v0.1.0 | RFC: FIND-0002 | Task: CTX-0202

Finding (FIND-0002 CR-RENDER-01, HIGH, memory/DoS)

bitty-render/src/gpu.rs headless present_draw_list (and headless_present) allocate w*h*4 bytes with unchecked as usize arithmetic, so extreme extents OOM the host.

Remediation

Checked arithmetic against MAX_SURFACE_BYTES (64 MiB), mirroring software.rs (SurfaceRgba::try_new). Fail closed with RenderError::InvalidInput before any allocation.

Acceptance criteria

  • Extreme extents (e.g. 5000x5000, u32::MAX x u32::MAX) fail closed with InvalidInput; no allocation occurs.
  • Normal frames (e.g. 640x384, 800x600) present unchanged.
  • Regression tests + fmt/clippy/test gates green.

Activity

  1. added this to the v0.1.0 milestone on Sep 6, 2026
  2. added
    fix
    P1
    area:render
    on Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1area:renderfix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions