Merge pull request #7038 from SparkiDev/heapmath_mp_add_d

Heapmath mp_add_d: fix for when a and c same pointer
This commit is contained in:
JacobBarthelmeh 2023-12-07 10:04:13 -07:00 committed by GitHub
commit 5caa71ec6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4425,9 +4425,6 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) *
/* old number of used digits in c */
oldused = c->used;
/* sign always positive */
c->sign = MP_ZPOS;
/* source alias */
tmpa = a->dp;
@ -4478,6 +4475,9 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) *
ix = 1;
}
/* sign always positive */
c->sign = MP_ZPOS;
/* now zero to oldused */
while (ix++ < oldused) {
*tmpc++ = 0;