diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2021-12-12 14:24:10 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2021-12-12 14:24:10 +0100 |
commit | 650368f11361f45af429cac9690c9d85885d765c (patch) | |
tree | 06411f3152ec58173e1bd8fb0d6327f68ad3f78f /mpz/init2.c | |
parent | 5ea34d9f6fd6ebe37653ea64dac820e05cb160d5 (diff) | |
download | gmp-650368f11361f45af429cac9690c9d85885d765c.tar.gz |
Handle overflow in mpz_type through errno.
Diffstat (limited to 'mpz/init2.c')
-rw-r--r-- | mpz/init2.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/mpz/init2.c b/mpz/init2.c index fcbaa66db..3133f60ab 100644 --- a/mpz/init2.c +++ b/mpz/init2.c @@ -1,6 +1,6 @@ /* mpz_init2 -- initialize mpz, with requested size in bits. -Copyright 2001, 2002, 2008 Free Software Foundation, Inc. +Copyright 2001, 2002, 2008, 2021 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -43,10 +43,7 @@ mpz_init2 (mpz_ptr x, mp_bitcnt_t bits) if (sizeof (unsigned long) > sizeof (int)) /* param vs _mp_size field */ { if (UNLIKELY (new_alloc > INT_MAX)) - { - fprintf (stderr, "gmp: overflow in mpz type\n"); - abort (); - } + MPZ_OVERFLOW; } PTR(x) = __GMP_ALLOCATE_FUNC_LIMBS (new_alloc); |