[or-cvs] r10813: Backport 10812: avoid roundoff-error-induced crash bugs when (in tor/branches/tor-0_1_2-patches: . src/or)

nickm at seul.org nickm at seul.org
Thu Jul 12 16:35:10 UTC 2007


Author: nickm
Date: 2007-07-12 12:35:10 -0400 (Thu, 12 Jul 2007)
New Revision: 10813

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/routerlist.c
Log:
 r13732 at catbus:  nickm | 2007-07-12 12:35:06 -0400
 Backport 10812: avoid roundoff-error-induced crash bugs when picking routers by bandwith.



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r13732] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-07-12 16:34:45 UTC (rev 10812)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-07-12 16:35:10 UTC (rev 10813)
@@ -27,6 +27,9 @@
   o Minor bugfixes (misc)
     - On Windows, we were preventing other processes from reading
       cached-routers while Tor was running.  (Reported by janbar)
+    - Fix a possible (but very unlikely) bug in picking routers by bandwidth.
+      Add a log message to confirm that it is in fact unlikely. (Patch from
+      lodger.)
     - Backport miscellaneous cosmetic bugfixes.
 
 

Modified: tor/branches/tor-0_1_2-patches/src/or/routerlist.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/routerlist.c	2007-07-12 16:34:45 UTC (rev 10812)
+++ tor/branches/tor-0_1_2-patches/src/or/routerlist.c	2007-07-12 16:35:10 UTC (rev 10813)
@@ -1082,6 +1082,12 @@
     if (tmp >= rand_bw)
       break;
   }
+  if (i == smartlist_len(sl)) {
+    /* This is possible due to round-off error. */
+    --i;
+    log_warn(LD_BUG, "Round-off error in computing bandwidth had an effect on "
+             " which router we chose.  Please tell the developers.");
+  }
   tor_free(bandwidths);
   return smartlist_get(sl, i);
 }



More information about the tor-commits mailing list