[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#284978: general: libgmp segfaults on generating 48402688-bit random number

Package: general
Version: 20041209
Severity: normal

The program

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "gmp.h"

int main(int argc, char** argv)
  mpz_t A,B,C;
  gmp_randstate_t state;

  gmp_randseed_ui(state, 3);

  mpz_urandomb(A, state, 48402688);
  mpz_urandomb(B, state, 845*32);

compiled with gcc = gcc-2.95.4, gmp = gmp-4.0.1

segfaults in the mpz_urandomb() function
with a back-trace
#0  0x4003d051 in __gmpn_copyi () from /usr/lib/libgmp.so.3
#1  0x40023012 in __gmp_randinit_lc_2exp () from /usr/lib/libgmp.so.3
#2  0x4002310d in __gmp_rand () from /usr/lib/libgmp.so.3
#3  0x400331f8 in __gmpz_urandomb () from /usr/lib/libgmp.so.3
#4  0x0804861b in main (argc=1, argv=0xbffffca4) at use-gcds-BUG.c:14

-- System Information
Debian Release: 3.0
Kernel Version: Linux chiark 2.4.28 #2 SMP Mon Nov 22 15:56:31 GMT 2004 i686 unknown

Reply to: