Browse Source

Fix an assert error introduced in 0.1.2.5-alpha: if a single TLS
connection handles more than 4 gigs in either direction, we assert.


svn:r9306

Roger Dingledine 19 years ago
parent
commit
1d8a4cb989
2 changed files with 4 additions and 3 deletions
  1. 2 0
      ChangeLog
  2. 2 3
      src/common/tortls.c

+ 2 - 0
ChangeLog

@@ -31,6 +31,8 @@ Changes in version 0.1.2.6-alpha - 2007-??-??
       excess load to the exit nodes.
       excess load to the exit nodes.
 
 
   o Major bugfixes:
   o Major bugfixes:
+    - Fix an assert error introduced in 0.1.2.5-alpha: if a single TLS
+      connection handles more than 4 gigs in either direction, we assert.
     - Fix an assert error introduced in 0.1.2.5-alpha: if you're an
     - Fix an assert error introduced in 0.1.2.5-alpha: if you're an
       advertised exit node, somebody might try to exit from you when
       advertised exit node, somebody might try to exit from you when
       you're bootstrapping and before you've built your descriptor yet.
       you're bootstrapping and before you've built your descriptor yet.

+ 2 - 3
src/common/tortls.c

@@ -871,12 +871,11 @@ tor_tls_get_n_raw_bytes(tor_tls_t *tls, size_t *n_read, size_t *n_written)
   unsigned long r, w;
   unsigned long r, w;
   r = BIO_number_read(SSL_get_rbio(tls->ssl));
   r = BIO_number_read(SSL_get_rbio(tls->ssl));
   w = BIO_number_written(SSL_get_wbio(tls->ssl));
   w = BIO_number_written(SSL_get_wbio(tls->ssl));
-  /* If we wrapped around, this should still give us the right answer, unless
+  /* We are ok with letting these unsigned ints go "negative" here:
+   * If we wrapped around, this should still give us the right answer, unless
    * we wrapped around by more than ULONG_MAX since the last time we called
    * we wrapped around by more than ULONG_MAX since the last time we called
    * this function.
    * this function.
    */
    */
-  tor_assert(r >= tls->last_read_count);
-  tor_assert(w >= tls->last_write_count);
   *n_read = (size_t)(r - tls->last_read_count);
   *n_read = (size_t)(r - tls->last_read_count);
   *n_written = (size_t)(w - tls->last_write_count);
   *n_written = (size_t)(w - tls->last_write_count);
   tls->last_read_count = r;
   tls->last_read_count = r;