From 7ce3860e19d9ffffcdbcfdb3947192a1b63564f3 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Wed, 17 Feb 2021 09:24:22 +1000 Subject: [PATCH] MP small: mp_add_d doesn't support adding a digit greater than MP_DIGIT_MAX --- wolfcrypt/src/integer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 81987f96d..40eaf5cee 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -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) {