T09 · Insecure Skill Coding Practices
- Location
scripts/calculate_feeding.py:52- Finding
Unbounded Pool Range Expansion Enables Resource Exhaustion
- Content
View full analysis
- Remediation
View remediation
List[int]: pools = [] for raw_part in pool_range.split(','): part = raw_part.strip() if not part: raise ValueError("Empty pool-range component") if '-' in part: components = part.split('-') if len(components) != 2: raise ValueError("Invalid pool-range format") start, end = map(int, components) if start > end: raise ValueError("Pool-range start exceeds end") if start < MIN_POOL or end > MAX_POOL: raise ValueError("Pool number is outside the allowed range") if len(pools) + (end - start + 1) > MAX_EXPANDED_POOLS: raise ValueError("Too many pools in one record") pools.extend(range(start, end + 1)) else: pool = int(part) if pool < MIN_POOL or pool > MAX_POOL: raise ValueError("Pool number is outside the allowed range") if len(pools) >= MAX_EXPANDED_POOLS: raise ValueError("Too many pools in one record") pools.append(pool) return sorted(set(pools)) ``` ]]>
