Merge pull request #3127 from SparkiDev/mp_sub_d

mp_sub_d (integer.c): return error when digit is too big
pull/2713/head^2
toddouska 2020-07-22 16:38:37 -07:00 committed by GitHub
commit ea21d56463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -4322,6 +4322,8 @@ int mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
mp_digit *tmpa, *tmpc, mu;
int res, ix, oldused;
if (b > MP_MASK) return MP_VAL;
/* grow c as required */
if (c->alloc < a->used + 1) {
if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) {