Issue 1673 assert about division algorithm state to avoid strange infinite loop situation

git-svn-id: https://zxing.googlecode.com/svn/trunk@2690 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-04-25 18:49:01 +00:00
parent 25f00bfdaf
commit 9d1497fd27

View file

@ -85,7 +85,7 @@ public final class ReedSolomonDecoder {
}
}
private GenericGFPoly[] runEuclideanAlgorithm(GenericGFPoly a, GenericGFPoly b, int R)
public GenericGFPoly[] runEuclideanAlgorithm(GenericGFPoly a, GenericGFPoly b, int R)
throws ReedSolomonException {
// Assume a's degree is >= b's
if (a.getDegree() < b.getDegree()) {
@ -123,6 +123,10 @@ public final class ReedSolomonDecoder {
}
t = q.multiply(tLast).addOrSubtract(tLastLast);
if (r.getDegree() >= rLast.getDegree()) {
throw new IllegalStateException("Division algorithm failed to reduce polynomial?");
}
}
int sigmaTildeAtZero = t.getCoefficient(0);