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

selectors: fix missing bounds check on int conversion #25

Merged

Conversation

willfindlay
Copy link
Contributor

@willfindlay willfindlay commented May 14, 2022

This PR fixes an issue revealed by the new codeql lints ci job.

We were parsing a 64-bit integer here and converting to a u32 without a bounds check. This
is obviously wrong, so drop the bit size on the ParseInt call down to 32 and make it
ParseUint. Additionally, split up signed and unsigned cases in parseMatchValues() so that
we can properly parse the signed/unsigned integer types.

Signed-off-by: William Findlay [email protected]

We were parsing a 64-bit integer here and converting to a u32 without a bounds check. This
is obviously wrong, so drop the bit size on the ParseInt call down to 32 and make it
ParseUint. Additionally, split up signed and unsigned cases in parseMatchValues() so that
we can properly parse the signed/unsigned integer types.

Signed-off-by: William Findlay <[email protected]>
@michi-covalent michi-covalent merged commit a7f1c71 into cilium:main May 15, 2022
@willfindlay willfindlay deleted the pr/willfindlay/fix-codeql-lints branch May 15, 2022 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants