mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Merge branch 'main' into pawel_signatures_conversion
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: feature
|
||||
---
|
||||
* Added a predicate `getAnAttribute` to `Namespace` to retrieve a namespace attribute.
|
||||
@@ -42,6 +42,8 @@ module PrivateCleartextWrite {
|
||||
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
|
||||
|
||||
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
|
||||
|
||||
predicate observeDiffInformedIncrementalMode() { any() }
|
||||
}
|
||||
|
||||
module WriteFlow = TaintTracking::Global<WriteConfig>;
|
||||
|
||||
@@ -99,6 +99,11 @@ class Namespace extends NameQualifyingElement, @namespace {
|
||||
|
||||
/** Gets a file which declares (part of) this namespace. */
|
||||
File getAFile() { result = this.getADeclarationEntry().getLocation().getFile() }
|
||||
|
||||
/** Gets an attribute of this namespace. */
|
||||
Attribute getAnAttribute() {
|
||||
namespaceattributes(underlyingElement(this), unresolveElement(result))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ private import semmle.code.cpp.ir.implementation.internal.OperandTag
|
||||
private import semmle.code.cpp.ir.internal.CppType
|
||||
private import semmle.code.cpp.models.interfaces.SideEffect
|
||||
private import semmle.code.cpp.models.interfaces.Throwing
|
||||
private import semmle.code.cpp.models.interfaces.NonThrowing
|
||||
private import InstructionTag
|
||||
private import SideEffects
|
||||
private import TranslatedElement
|
||||
@@ -366,6 +367,10 @@ class TranslatedFunctionCall extends TranslatedCallExpr, TranslatedDirectCall {
|
||||
or
|
||||
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
|
||||
e instanceof SehExceptionEdge
|
||||
or
|
||||
not expr.getTarget() instanceof NonCppThrowingFunction and
|
||||
exists(TryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
|
||||
e instanceof CppExceptionEdge
|
||||
}
|
||||
|
||||
final override predicate mustThrowException(ExceptionEdge e) {
|
||||
|
||||
@@ -381,6 +381,14 @@ abstract class TranslatedValueCategoryAdjustment extends TranslatedExpr {
|
||||
final TranslatedCoreExpr getOperand() { result.getExpr() = expr }
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `expr` requires an `SehExceptionEdge` to be generated.
|
||||
*/
|
||||
private predicate hasSehExceptionEdge(Expr expr) {
|
||||
expr instanceof PointerDereferenceExpr and
|
||||
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*())
|
||||
}
|
||||
|
||||
/**
|
||||
* IR translation of an implicit lvalue-to-rvalue conversion on the result of
|
||||
* an expression.
|
||||
@@ -400,7 +408,13 @@ class TranslatedLoad extends TranslatedValueCategoryAdjustment, TTranslatedLoad
|
||||
|
||||
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
|
||||
tag = LoadTag() and
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
(
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
or
|
||||
hasSehExceptionEdge(expr) and
|
||||
kind instanceof SehExceptionEdge and
|
||||
result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge e))
|
||||
)
|
||||
}
|
||||
|
||||
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
|
||||
@@ -1945,7 +1959,13 @@ class TranslatedAssignExpr extends TranslatedNonConstantExpr {
|
||||
|
||||
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
|
||||
tag = AssignmentStoreTag() and
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
(
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
or
|
||||
hasSehExceptionEdge(expr.getLValue()) and
|
||||
kind instanceof SehExceptionEdge and
|
||||
result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge e))
|
||||
)
|
||||
}
|
||||
|
||||
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
|
||||
|
||||
@@ -1139,6 +1139,11 @@ varattributes(
|
||||
int spec_id: @attribute ref
|
||||
);
|
||||
|
||||
namespaceattributes(
|
||||
int namespace_id: @namespace ref,
|
||||
int spec_id: @attribute ref
|
||||
);
|
||||
|
||||
stmtattributes(
|
||||
int stmt_id: @stmt ref,
|
||||
int spec_id: @attribute ref
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
description: Add a predicate `getAnAttribute` to `Namespace`
|
||||
compatibility: backwards
|
||||
Reference in New Issue
Block a user