From 431f36352067c839ed6abfd829588940006c11e4 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 3 Mar 2017 07:35:26 -0800 Subject: [PATCH] Better fixes for suppressing scan-build warning with normal math enabled. --- wolfcrypt/src/integer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index c5026bf6d..380b5bccf 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -336,10 +336,6 @@ int mp_copy (mp_int * a, mp_int * b) } } - /* sanity check on destination */ - if (b->dp == NULL) - return MP_VAL; - /* zero b and copy the parameters over */ { mp_digit *tmpa, *tmpb; @@ -358,7 +354,7 @@ int mp_copy (mp_int * a, mp_int * b) } /* clear high digits */ - for (; n < b->used; n++) { + for (; n < b->used && b->dp; n++) { *tmpb++ = 0; } } @@ -3776,7 +3772,7 @@ int s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) pa = a->used; pb = b->used; - for (ix = 0; ix < pa; ix++) { + for (ix = 0; ix < pa && a->dp; ix++) { /* clear the carry */ u = 0; @@ -3849,7 +3845,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) /* number of output digits to produce */ pa = a->used + b->used; _W = 0; - for (ix = digs; ix < pa; ix++) { + for (ix = digs; ix < pa && a->dp; ix++) { int tx, ty, iy; mp_digit *tmpx, *tmpy;