-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
READ_DATA
macro needs checks before float to int casts
#241
Comments
One idea would be to additionally pass min and max rage values to macros READ_DATA and READ_COMPRESSED_DATA and check if in range before casting. |
seanm
added a commit
to seanm/matio
that referenced
this issue
Mar 4, 2024
seanm
added a commit
to seanm/matio
that referenced
this issue
Mar 5, 2024
seanm
added a commit
to seanm/matio
that referenced
this issue
Mar 5, 2024
seanm
added a commit
to seanm/matio
that referenced
this issue
Mar 19, 2024
tbeu
pushed a commit
to seanm/matio
that referenced
this issue
Oct 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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...
The text was updated successfully, but these errors were encountered: