From 8b6b91011ff7bec27f5a4298ac9868a522661cdd Mon Sep 17 00:00:00 2001 From: Tristan Swadell Date: Fri, 3 Jul 2026 15:59:51 +0100 Subject: [PATCH] Update lists.go runtime cost calculator Ensure negative cost factors are normalized to 1.0 to safeguard against error inputs. --- ext/lists.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/lists.go b/ext/lists.go index 37ae2d3d..b4ac2589 100644 --- a/ext/lists.go +++ b/ext/lists.go @@ -779,6 +779,9 @@ func trackListSelfCompare(l traits.Lister) *uint64 { // trackAllocatingListCall computes costs as a function of the size of the result list with a baseline cost // for the call dispatch and the associated list allocation. func trackAllocatingListCall(costFactor float64, size uint64) *uint64 { + if costFactor < 0.0 { + costFactor = 1.0 + } cost := safeAdd(uint64(float64(size)*costFactor), callCost, common.ListCreateBaseCost) return &cost }