From 92533e662ea6f52ca31bbe4522f9cb723b95c62c Mon Sep 17 00:00:00 2001 From: Alexander Kuechler Date: Tue, 17 Dec 2024 13:10:01 +0100 Subject: [PATCH] Add sanity check --- .../kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt | 2 +- .../main/kotlin/de/fraunhofer/aisec/cpg/passes/PointsToPass.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt b/cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt index 76f2f6e204..40c6a95e82 100644 --- a/cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt +++ b/cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt @@ -42,7 +42,7 @@ import de.fraunhofer.aisec.cpg.passes.configuration.DependsOn * A [Pass] which uses a simple logic to determine constant values and mark unreachable code regions * by setting the [EvaluationOrder.unreachable] property to true. */ -@DependsOn(ControlFlowSensitiveDFGPass::class) +@DependsOn(ControlFlowSensitiveDFGPass::class, softDependency = true) class UnreachableEOGPass(ctx: TranslationContext) : TranslationUnitPass(ctx) { override fun cleanup() { // Nothing to do diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PointsToPass.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PointsToPass.kt index a81fba63b3..050e1f84bc 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PointsToPass.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PointsToPass.kt @@ -655,7 +655,7 @@ class PointsToPass(ctx: TranslationContext) : EOGStarterPass(ctx, orderDependenc if (derefSource) { this.getValues(node.arguments[v.argumentIndex]) .forEach { r.addAll(this.getValues(it)) } - } else { + } else if (v.argumentIndex < node.arguments.size) { r.add(node.arguments[v.argumentIndex]) } } else r.add(v)