From 6bfc0a7a1cd4811141633287396bf0487eb3b80a Mon Sep 17 00:00:00 2001 From: Asger Feldthaus Date: Fri, 11 Feb 2022 08:38:15 +0100 Subject: [PATCH] Go: use parseConstantOrRange in parseReturn --- .../go/dataflow/internal/FlowSummaryImplSpecific.qll | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll b/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll index 1ebd9bf1294..c9fc47e073a 100644 --- a/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll @@ -277,13 +277,7 @@ predicate parseReturn(string c, int n) { ( c = "ReturnValue" and n = 0 or - c.regexpCapture("ReturnValue\\[([-0-9]+)\\]", 1).toInt() = n - or - exists(int n1, int n2 | - c.regexpCapture("ReturnValue\\[([-0-9]+)\\.\\.([0-9]+)\\]", 1).toInt() = n1 and - c.regexpCapture("ReturnValue\\[([-0-9]+)\\.\\.([0-9]+)\\]", 2).toInt() = n2 and - n = [n1 .. n2] - ) + n = parseConstantOrRange(c.regexpCapture("ReturnValue\\[([^\\]]+)\\]", 1)) ) }