From 4d0ad34a92dff2be0b23e75ca5373054a5c9334a Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 29 Sep 2014 20:24:40 +1000 Subject: Avoid division by zero in circuitstats pareto In circuit_build_times_calculate_timeout() in circuitstats.c, avoid dividing by zero in the pareto calculations. If either the alpha or p parameters are 0, we would divide by zero, yielding an infinite result; which would be clamped to INT32_MAX anyway. So rather than dividing by zero, we just skip the offending calculation(s), and use INT32_MAX for the result. Division by zero traps under clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error. --- changes/bug13290-avoid-div-zero-circuitstatus-pareto | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changes/bug13290-avoid-div-zero-circuitstatus-pareto (limited to 'changes') diff --git a/changes/bug13290-avoid-div-zero-circuitstatus-pareto b/changes/bug13290-avoid-div-zero-circuitstatus-pareto new file mode 100644 index 0000000000..42b121f9dd --- /dev/null +++ b/changes/bug13290-avoid-div-zero-circuitstatus-pareto @@ -0,0 +1,5 @@ + o Minor bugfixes: + - In circuit_build_times_calculate_timeout() in circuitstats.c, avoid + dividing by zero in the pareto calculations. This traps under + clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error. + Fixes bug 13290. -- cgit v1.2.3-54-g00ecf