Skip to content

Texture::update has segmentation fault when pitch is invalid for pixel source data #814

Open
@MadRubicant

Description

@MadRubicant

I was attempting to use Texture::update(rect: Option<Rect>, pixel_data: &[u8], pitch: usize) -> Result<(), UpdateTextureError> to copy a single pixel across the entire texture (which I'm now assuming isn't allowed), and the result is a segfault in SDL_Blit_N(...).

Repro:

let (r, g, b, a) = color.rgba();
tex.update(None, &[r,g,b,a], width * 4)
    .expect("Error updating texture data");

Expected result: Panic
Actual result: Segfault

System is arch linux, x86-64, with version sdl2-32.0-beta.2 (though I upgraded from 31.0 in hopes of fixing it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions