1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

fixed some valgrind detected issues.

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@185 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich 2011-01-02 22:38:59 +00:00
parent 28c35cf0f3
commit bc9a451b51

View File

@ -826,11 +826,10 @@ static bigint *regular_multiply(BI_CTX *ctx, bigint *bia, bigint *bib,
do
{
comp carry = 0;
comp b = *sb++;
int r_index = i;
j = 0;
if (outer_partial)
if (outer_partial && outer_partial-i > 0 && outer_partial < n)
{
r_index = outer_partial-1;
j = outer_partial-i-1;
@ -843,7 +842,7 @@ static bigint *regular_multiply(BI_CTX *ctx, bigint *bia, bigint *bib,
break;
}
long_comp tmp = sr[r_index] + ((long_comp)sa[j])*b + carry;
long_comp tmp = sr[r_index] + ((long_comp)sa[j])*sb[i] + carry;
sr[r_index++] = (comp)tmp; /* downsize */
carry = tmp >> COMP_BIT_SIZE;
} while (++j < n);
@ -945,7 +944,7 @@ static bigint *regular_square(BI_CTX *ctx, bigint *bi)
{
int t = bi->size;
int i = 0, j;
bigint *biR = alloc(ctx, t*2);
bigint *biR = alloc(ctx, t*2+1);
comp *w = biR->comps;
comp *x = bi->comps;
long_comp carry;