Merge pull request #3844 from SparkiDev/mp_read_radix_fail

MP small: read radix set result to 0 on all errors
This commit is contained in:
toddouska
2021-03-05 12:09:38 -08:00
committed by GitHub

View File

@ -5229,9 +5229,11 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
*/
if (y < radix) {
if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) {
mp_zero(a);
return res;
}
if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) {
mp_zero(a);
return res;
}
} else {