Skip to content

i_video: cmap_to_fb silently treats unsupported bpp as 32 instead of calling I_Error #130

Description

@sunsided

Context

cmap_to_fb in room/src/doom/i_video.rs dispatches between the 16-bpp and 32-bpp framebuffer paths based on s_Fb.bits_per_pixel.

C behavior

i_video.c calls I_Error for any bits_per_pixel other than 16 or 32, aborting the program.

Rust behavior

The Rust port falls through to the 32-bpp path for any value that is not 16. If bits_per_pixel is corrupted, the function writes garbage rather than crashing.

Location

room/src/doom/i_video.rs:196 (flagged with // FIXME:).

Suggested fix

After the bpp == 16 early return, panic / call the Rust equivalent of I_Error when bpp != 32.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions