aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-03-15 20:13:54 -0400
committerJack Lloyd <[email protected]>2016-03-15 20:13:54 -0400
commit539170d9acbe73f9e3b6a17bec41dfeb817a9fb8 (patch)
tree3fc0a247a1859eb5184dc21dd675c5a206f2fda1 /src/lib
parent8bbc2a99ddce2ef8a0ab0b8114ba0edf378d4f1a (diff)
Fix off by one in ressol
Could attempt to allocate (size_t)-1 words with predicably bad_alloc results.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/math/numbertheory/ressol.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/math/numbertheory/ressol.cpp b/src/lib/math/numbertheory/ressol.cpp
index 127dc899e..2c83cb0e0 100644
--- a/src/lib/math/numbertheory/ressol.cpp
+++ b/src/lib/math/numbertheory/ressol.cpp
@@ -66,7 +66,7 @@ BigInt ressol(const BigInt& a, const BigInt& p)
q = mod_p.square(q);
++i;
- if(i > s)
+ if(i >= s)
{
return -BigInt(1);
}