Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / gmp / 5.1.3-CVE-2021-43618.patch
blob13b9bc5f58cd9477088803d7e9f992f8af19c9cf
1 Based on https://gmplib.org/repo/gmp-6.2/raw-rev/561a9c25298e,
2 adapted for 5.x by ris
4 diff -r e1fd9db13b47 -r 561a9c25298e mpz/inp_raw.c
5 --- a/mpz/inp_raw.c Tue Dec 22 23:49:51 2020 +0100
6 +++ b/mpz/inp_raw.c Thu Oct 21 19:06:49 2021 +0200
7 @@ -81,8 +81,11 @@
9 abs_csize = ABS (csize);
11 + if (UNLIKELY (abs_csize > ~(mp_bitcnt_t) 0 / 8))
12 + return 0; /* Bit size overflows */
14 /* round up to a multiple of limbs */
15 - abs_xsize = (abs_csize*8 + GMP_NUMB_BITS-1) / GMP_NUMB_BITS;
16 + abs_xsize = ((mp_bitcnt_t)abs_csize*8 + GMP_NUMB_BITS-1) / GMP_NUMB_BITS;
18 if (abs_xsize != 0)