This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch misc-hardening__MATH-1691 in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit f0cad7ba63d6735edf7d3e0e1e0f17297ffdbe4f Author: Gilles Sadowski <[email protected]> AuthorDate: Sun Sep 27 18:46:43 2026 +0200 MATH-1691: Prevent infinite loop on NaN input. Found by a security scan. --- .../src/main/java/org/apache/commons/math4/neuralnet/Neuron.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons-math-neuralnet/src/main/java/org/apache/commons/math4/neuralnet/Neuron.java b/commons-math-neuralnet/src/main/java/org/apache/commons/math4/neuralnet/Neuron.java index 174cadd77..345256cd6 100644 --- a/commons-math-neuralnet/src/main/java/org/apache/commons/math4/neuralnet/Neuron.java +++ b/commons-math-neuralnet/src/main/java/org/apache/commons/math4/neuralnet/Neuron.java @@ -209,7 +209,7 @@ public class Neuron { } for (int i = 0; i < size; i++) { - if (!Precision.equals(current[i], expect[i])) { + if (!Precision.equalsIncludingNaN(current[i], expect[i])) { return false; } }
