aboutsummaryrefslogtreecommitdiff
path: root/src/math/subgroup.c
diff options
context:
space:
mode:
authorJ08nY2025-03-23 17:06:57 +0100
committerJ08nY2025-03-23 17:06:57 +0100
commite7341fa4dfc03570eb97f0b4b6fad60af445a282 (patch)
treed5d53af1d0556aa64cc0c19474f7c8d018f02188 /src/math/subgroup.c
parentea8200d09d93a7b45332cb897f80464a761e766f (diff)
downloadecgen-e7341fa4dfc03570eb97f0b4b6fad60af445a282.tar.gz
ecgen-e7341fa4dfc03570eb97f0b4b6fad60af445a282.tar.zst
ecgen-e7341fa4dfc03570eb97f0b4b6fad60af445a282.zip
Have a bound on the CM walkdown, the discriminant grows too much otherwise.
Diffstat (limited to '')
-rw-r--r--src/math/subgroup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/math/subgroup.c b/src/math/subgroup.c
index fdf45a5..0b5c515 100644
--- a/src/math/subgroup.c
+++ b/src/math/subgroup.c
@@ -3,6 +3,7 @@
* Copyright (C) 2017-2018 J08nY
*/
#include "subgroup.h"
+#include "io/output.h"
/**
* @brief All prime divisors of a given integer with multiplicity.
@@ -46,6 +47,11 @@ static GEN subgroups_2n_factors(GEN factors, size_t min_bits) {
long nprimes = glength(factors);
if (nprimes == min_bits) return NULL;
GEN amount = int2n(nprimes);
+ long abits = logint(amount, gen_2);
+ if (abits >= 64) {
+ fprintf(err, "Too many factors to generate points (%li bits).", abits);
+ return NULL;
+ }
GEN groups = gtovec0(gen_0, itos(amount) - (min_bits * nprimes) - 1);
size_t i = 0;