[PR #18451] Multiple fixes to address CodeQL requirements #31532

Open
opened 2026-01-31 09:47:51 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/18451

State: closed
Merged: Yes


Summary of the Pull Request

After taking in 1.22, our CodeQL process caught a few locations where we weren't following the right guidance:

  • Performing integer comparisons of different sizes which could lead to an infinite loop if the larger integer goes out of range of the smaller integer
  • Not checking HResult of a called method

References and Relevant Issues

CodeQL issues:
https://liquid.microsoft.com/codeql/issues/5f2b05d5-9e87-4df4-b493-f00e710d38df?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058
https://liquid.microsoft.com/codeql/issues/76268284-2d4b-4b10-8aff-a947ecc1a576?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058
https://liquid.microsoft.com/codeql/issues/452f966b-5b99-420e-96c0-153caea2a0b4?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058
https://liquid.microsoft.com/codeql/issues/3e57ab90-fbec-455e-adef-75c3ab8f4933?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058

Detailed Description of the Pull Request / Additional comments

I used saturated_cast<> for these changes to make overflow values equal to the max value of the smallest integer.

Validation Steps Performed

PR Checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated
    • If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated (if necessary)
**Original Pull Request:** https://github.com/microsoft/terminal/pull/18451 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request After taking in 1.22, our CodeQL process caught a few locations where we weren't following the right guidance: - Performing integer comparisons of different sizes which could lead to an infinite loop if the larger integer goes out of range of the smaller integer - Not checking HResult of a called method ## References and Relevant Issues CodeQL issues: https://liquid.microsoft.com/codeql/issues/5f2b05d5-9e87-4df4-b493-f00e710d38df?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058 https://liquid.microsoft.com/codeql/issues/76268284-2d4b-4b10-8aff-a947ecc1a576?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058 https://liquid.microsoft.com/codeql/issues/452f966b-5b99-420e-96c0-153caea2a0b4?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058 https://liquid.microsoft.com/codeql/issues/3e57ab90-fbec-455e-adef-75c3ab8f4933?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058 ## Detailed Description of the Pull Request / Additional comments I used `saturated_cast<>` for these changes to make overflow values equal to the max value of the smallest integer. ## Validation Steps Performed ## PR Checklist - [ ] Closes #xxx - [ ] Tests added/passed - [ ] Documentation updated - If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx - [ ] Schema updated (if necessary)
claunia added the pull-request label 2026-01-31 09:47:51 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31532