Skip to content

C++: Add exception edges out of calls inside try statements #19787

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

Merged
merged 2 commits into from
Jun 17, 2025

Conversation

MathiasVP
Copy link
Contributor

Same as #19746, but for C++ exceptions (whereas #19746 was for SEH exceptions).

@github-actions github-actions bot added the C++ label Jun 16, 2025
@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Jun 16, 2025
@MathiasVP MathiasVP marked this pull request as ready for review June 16, 2025 22:48
@Copilot Copilot AI review requested due to automatic review settings June 16, 2025 22:48
@MathiasVP MathiasVP requested a review from a team as a code owner June 16, 2025 22:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces C++ exception edges for calls inside try statements and updates the corresponding test expectations.

  • Updated library test .expected files to remove obsolete SEH entries and reflect new C++ exception edges.
  • Extended TranslatedFunctionCall in TranslatedCall.qll to include C++ exception edges for functions that may throw.

Reviewed Changes

Copilot reviewed 8 out of 6 changed files in this pull request and generated no comments.

File Description
cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected Removed outdated SEH entries for calls inside try
cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected Cleaned up obsolete expected line for SEH exception edge
cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected Adjusted IR test expectations to add C++ exception edges
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll Imported interface and updated isExceptionalEdge predicate to handle C++ exception edges
Comments suppressed due to low confidence (2)

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll:371

  • The predicate references NonCppThrowingFunction, but only NonThrowing was imported. Either import the correct NonCppThrowingFunction interface or update the code to use the imported interface.
not expr.getTarget() instanceof NonCppThrowingFunction

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll:7

  • [nitpick] The imported NonThrowing interface is not used elsewhere in this file; consider removing it if it’s not needed after addressing the predicate reference.
private import semmle.code.cpp.models.interfaces.NonThrowing

@MathiasVP MathiasVP merged commit e1b9d9f into github:main Jun 17, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants