OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
273 stars 203 forks source link

Remove recursion in getclosedlink #754

Closed lbutler closed 10 months ago

lbutler commented 10 months ago

The function getclosedlink in report.c uses recursion to find closed links when reporting on disconnections.

In very large networks, it’s possible for the recursion to exhaust the memory on the call stack which then causes EPANET to crash.

If a loop is used instead of recursion, EPANET will not crash with very large disconnections

Fixes #737