summaryrefslogtreecommitdiff
path: root/mpz/jacobi.c
diff options
context:
space:
mode:
authorNiels M?ller <nisse@lysator.liu.se>2012-12-05 21:37:31 +0100
committerNiels M?ller <nisse@lysator.liu.se>2012-12-05 21:37:31 +0100
commitf5283e4380628191d68d0f3a4f21e0bfdc1453b5 (patch)
tree3f16d4b06c67b2b31a216850d8c2c45cb7898b64 /mpz/jacobi.c
parentb6702a8ccb1fb66793e4b3b535cc7a35d6dc42b2 (diff)
downloadgmp-f5283e4380628191d68d0f3a4f21e0bfdc1453b5.tar.gz
mpz_jacobi: Fix uninitialized read of low limb.
Diffstat (limited to 'mpz/jacobi.c')
-rw-r--r--mpz/jacobi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mpz/jacobi.c b/mpz/jacobi.c
index 0ed41f8a1..26332494e 100644
--- a/mpz/jacobi.c
+++ b/mpz/jacobi.c
@@ -65,15 +65,11 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b)
bsrcp = PTR(b);
blow = bsrcp[0];
- /* The MPN jacobi functions requies positive a and b, and b odd. So
+ /* The MPN jacobi functions require positive a and b, and b odd. So
we must to handle the cases of a or b zero, then signs, and then
the case of even b.
*/
- if ( (((alow | blow) & 1) == 0))
- /* Common factor of 2 ==> (a/b) = 0 */
- return 0;
-
if (bsize == 0)
/* (a/0) = [ a = 1 or a = -1 ] */
return JACOBI_LS0 (alow, asize);
@@ -82,6 +78,10 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b)
/* (0/b) = [ b = 1 or b = - 1 ] */
return JACOBI_0LS (blow, bsize);
+ if ( (((alow | blow) & 1) == 0))
+ /* Common factor of 2 ==> (a/b) = 0 */
+ return 0;
+
if (bsize < 0)
{
/* (a/-1) = -1 if a < 0, +1 if a >= 0 */