Bug 1190248: Just initialize the |sign| field of |part| in s_mp_div().
authorWan-Teh Chang <wtc@google.com>
Tue, 25 Aug 2015 17:23:52 -0700
changeset 11564 cfd0ad4726cb1ba1d90946ac194390f56c40fd5b
parent 11563 7033b1193c9496b25aafe5b0ff87abf60949e522
child 11565 4a2025720da23460caf483a0b994f16063937ef9
push id724
push userwtc@google.com
push dateWed, 26 Aug 2015 00:23:59 +0000
bugs1190248
Bug 1190248: Just initialize the |sign| field of |part| in s_mp_div(). r=rrelyea.
lib/freebl/mpi/mpi.c
--- a/lib/freebl/mpi/mpi.c
+++ b/lib/freebl/mpi/mpi.c
@@ -4185,25 +4185,24 @@ mp_err   s_mp_div(mp_int *rem, 	/* i: di
     s_mp_div_2d(quot, (mp_digit)ix);
     s_mp_mod_2d(rem,  (mp_digit)ix);
 
     return MP_OKAY;
   }
 
   MP_SIGN(rem) = ZPOS;
   MP_SIGN(div) = ZPOS;
+  MP_SIGN(&part) = ZPOS;
 
   /* A working temporary for division     */
   MP_CHECKOK( mp_init_size(&t, MP_ALLOC(rem)));
 
   /* Normalize to optimize guessing       */
   MP_CHECKOK( s_mp_norm(rem, div, &d) );
 
-  part = *rem;
-
   /* Perform the division itself...woo!   */
   MP_USED(quot) = MP_ALLOC(quot);
 
   /* Find a partial substring of rem which is at least div */
   /* If we didn't find one, we're finished dividing    */
   while (MP_USED(rem) > MP_USED(div) || s_mp_cmp(rem, div) >= 0) {
     int i;
     int unusedRem;