Skip to content

READ_DATA macro needs checks before float to int casts #241

@seanm

Description

@seanm

Hi @tbeu,

I've been fuzzing lately, and found something that's better to discuss before I attempt any PR. The macro READ_DATA has this line:

data[i + j] = (T)SwapFunc(&v[j]);

When v is float/double it could be outside the range of the integer type T. Like for huge or non-finite floats. UBSan will then complain of undefined behaviour casting such things to integers.

Probably some range checks will be needed, but that may be tricky as this macro works for many different types...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions