From a4f7d4ff8d8df6bb2ec337961bf64b60d4a4575c Mon Sep 17 00:00:00 2001 From: "lubomir.marinov" Date: Fri, 19 Jun 2015 20:41:36 +0000 Subject: [PATCH] Fixes a stack overflow reported by James B. Byrne, investigated by Danny van Heumen. --- src/org/ice4j/ice/Candidate.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/org/ice4j/ice/Candidate.java b/src/org/ice4j/ice/Candidate.java index f44e605..c9ef4e7 100644 --- a/src/org/ice4j/ice/Candidate.java +++ b/src/org/ice4j/ice/Candidate.java @@ -316,13 +316,16 @@ public abstract class Candidate> } else { - baseEqualsCandidateBase = base.equals(candidateBase); + // If this and candidate are bases of themselves, their bases are + // considered equal. + baseEqualsCandidateBase + = (base == this && candidateBase == candidate) + || base.equals(candidateBase); } //compare other properties return - (baseEqualsCandidateBase - || (base == this && candidateBase == candidate)) + baseEqualsCandidateBase && getPriority() == candidate.getPriority() && getType() == candidate.getType() && getFoundation().equals(candidate.getFoundation()); @@ -995,4 +998,4 @@ public abstract class Candidate> { this.tcpType = tcpType; } -} \ No newline at end of file +}