mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Fix for integer.c possible uses of mp_int input with DP NULL.
This commit is contained in:
@@ -4378,6 +4378,10 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) // NOLINT(misc-no-recursion)
|
|||||||
/* destination alias */
|
/* destination alias */
|
||||||
tmpc = c->dp;
|
tmpc = c->dp;
|
||||||
|
|
||||||
|
if (tmpa == NULL || tmpc == NULL) {
|
||||||
|
return MP_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* if a is positive */
|
/* if a is positive */
|
||||||
if (a->sign == MP_ZPOS) {
|
if (a->sign == MP_ZPOS) {
|
||||||
/* add digit, after this we're propagating
|
/* add digit, after this we're propagating
|
||||||
@@ -4462,6 +4466,10 @@ int mp_sub_d (mp_int * a, mp_digit b, mp_int * c) // NOLINT(misc-no-recursion)
|
|||||||
tmpa = a->dp;
|
tmpa = a->dp;
|
||||||
tmpc = c->dp;
|
tmpc = c->dp;
|
||||||
|
|
||||||
|
if (tmpa == NULL || tmpc == NULL) {
|
||||||
|
return MP_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* if a <= b simply fix the single digit */
|
/* if a <= b simply fix the single digit */
|
||||||
if ((a->used == 1 && a->dp[0] <= b) || a->used == 0) {
|
if ((a->used == 1 && a->dp[0] <= b) || a->used == 0) {
|
||||||
if (a->used == 1) {
|
if (a->used == 1) {
|
||||||
|
Reference in New Issue
Block a user