Merge pull request #3768 from SparkiDev/mp_add_d_too_big

MP small: mp_add_d doesn't support adding a digit greater than MP_DIG…
pull/3812/head
toddouska 2021-02-25 16:56:23 -08:00 committed by GitHub
commit 4c1a94a6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

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