Hi,

Running the following commands will make you wait a long time:
----------------------------------------------------------------
set rng bbs
set rng bbs factors 23 -12345678901
----------------------------------------------------------------

Applying the fix in the attached patch immediately results in the error
message "You must specify two valid factors (see `help set rng bbs').",
preventing any long waits.

This typo not only causes it to accept an invalid negative 2nd argment
sz1, but also causes BBSFindGood() to start iterating from a large
negative integer in absolute value, even though BBSGood() rejects any
values less than 19.

Best regards,
-- 
TAKAHASHI Kaoru
>From 625dd4819baec8943846267a1b6924b01c111c4a Mon Sep 17 00:00:00 2001
From: TAKAHASHI Kaoru <[email protected]>
Date: Sat, 22 Aug 2026 09:41:52 +0900
Subject: [PATCH] InitRNGBBSFactors(): Fix a typo sign check for sz1

---
 dice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dice.c b/dice.c
index a286475e..1c3327b2 100644
--- a/dice.c
+++ b/dice.c
@@ -187,7 +187,7 @@ InitRNGBBSFactors(char *sz0, char *sz1, rngcontext * rngctx)
         return -1;
     }
 
-    if (mpz_init_set_str(q, sz1, 10) || mpz_sgn(p) < 1) {
+    if (mpz_init_set_str(q, sz1, 10) || mpz_sgn(q) < 1) {
         mpz_clear(p);
         mpz_clear(q);
         return -1;
-- 
2.47.3

Reply via email to