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...
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 typeT
. 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...