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

Fix CodeQL code scanning alerts #1972

Merged
merged 1 commit into from Dec 5, 2023
Merged

Conversation

helsaawy
Copy link
Contributor

Fix CodeQL alerts for unchecked downcasts from ints are to (u)int32 (or uintptr) without checking for overflow. This can (potentially) cause incorrect behavior due to the value wrapping around to an unexpected value.

Alerts:
https://github.com/microsoft/hcsshim/security/code-scanning?query=branch%3Amain+rule%3Ago%2Fincorrect-integer-conversion

Issue description:
https://cwe.mitre.org/data/definitions/190.html
https://cwe.mitre.org/data/definitions/681.html

Fix CodeQL alerts for unchecked downcasts from `int`s are to
`(u)int32` (or `uintptr`) without checking for overflow.
This can (potentially) cause incorrect behavior due to the value
wrapping around to an unexpected value.

Alerts:
https://github.com/microsoft/hcsshim/security/code-scanning?query=branch%3Amain+rule%3Ago%2Fincorrect-integer-conversion

Issue description:
https://cwe.mitre.org/data/definitions/190.html
https://cwe.mitre.org/data/definitions/681.html

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
@helsaawy helsaawy requested a review from a team as a code owner November 15, 2023 17:23
@helsaawy helsaawy changed the title Fix CodeQL coode scanning alerts Fix CodeQL code scanning alerts Nov 15, 2023
@helsaawy helsaawy merged commit 8570c66 into microsoft:main Dec 5, 2023
18 of 19 checks passed
@helsaawy helsaawy deleted the codeql-fix branch December 5, 2023 19:42
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.

None yet

3 participants