Skip to content

Unnecessary unsafety in HDR decoder #980

Description

@64

ret.set_len(pixel_count);

Vec::set_len leads to the creation of uninitialized memory which can be dropped if an error occurs during decoding. Additionally the other functions like decode_component have to be very careful to overwrite every single byte in the buffer lest uninitialized memory leak to the outside.

Is there any reason why vec![0; n] can't be used here? I doubt there would be a significant performance impact, if at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    draftAdd if this issue includes suggested code, compares interfaces, preparses wording,etckind: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions