From 936c4cc79fb0ded9f272e37e92a9ac1220470c1f Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Thu, 22 Jan 2026 22:12:30 +0000 Subject: [PATCH] Fix edge case in MaD validation If the db contains no pointer types then we were getting spurious model validation errors. --- go/ql/lib/semmle/go/dataflow/ExternalFlow.qll | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/go/ql/lib/semmle/go/dataflow/ExternalFlow.qll b/go/ql/lib/semmle/go/dataflow/ExternalFlow.qll index 7467d6c1d6c..388921224ad 100644 --- a/go/ql/lib/semmle/go/dataflow/ExternalFlow.qll +++ b/go/ql/lib/semmle/go/dataflow/ExternalFlow.qll @@ -153,7 +153,10 @@ module ModelValidation { not part = "" and not (part = "Argument" and pred = "sink") and not parseArg(part, _) and - not part.getName() = "Field" + // If the database does not contain any fields/pointer types then no + // FieldContent/PointerContent exists, so we spuriously think that + // these spec components are invalid. + not part.getName() = ["Field", "Dereference"] or part = input.getToken(0) and parseParam(part, _) @@ -176,7 +179,10 @@ module ModelValidation { invalidSpecComponent(output, part) and not part = "" and not (part = ["Argument", "Parameter"] and pred = "source") and - not part.getName() = "Field" + // If the database does not contain any fields/pointer types then no + // FieldContent/PointerContent exists, so we spuriously think that + // these spec components are invalid. + not part.getName() = ["Field", "Dereference"] or invalidIndexComponent(output, part) ) and