Skip to content
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

diod: Fix uint32 overflow when Tread/Twrite count > UINT32_MAX-IOHDRSZ #136

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

JJL772
Copy link
Contributor

@JJL772 JJL772 commented Mar 18, 2025

The check here is skipped if diod receives Tread or Twrite with a count greater than UINT32_MAX - IOHDRSZ (4294967271). This eventually trips an assert in np.c.

Let's just cast the incoming size to 64-bits before doing any math that may lead to an overflow.

I encountered this after forgetting to properly bound a read size.

The check here is skipped if diod receives Tread or Twrite with a count
greater than UINT32_MAX - IOHDRSZ (4294967271). Eventually this trips an
assert in np.c.

Let's just cast the incoming size to 64-bits before doing any math that
may lead to an overflow.
@JJL772 JJL772 force-pushed the fix-u32-overflow branch from e447485 to b91d74b Compare March 19, 2025 06:49
@JJL772 JJL772 changed the title diod: Fix uint32 overflow when Tread count > UINT32_MAX-IOHDRSZ diod: Fix uint32 overflow when Tread/Twrite count > UINT32_MAX-IOHDRSZ Mar 19, 2025
Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good!

@mergify mergify bot merged commit 54d1325 into chaos:master Mar 19, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants