[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/maint-0.2.6] Make the assert related to 15083 a tiny bit more tolerant



commit 81a994ce77038721df3aa2f77b783db9a52da79e
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Mar 3 22:25:26 2015 +0100

    Make the assert related to 15083 a tiny bit more tolerant
---
 changes/bug15083 |    6 +++++-
 src/or/buffers.c |    9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/changes/bug15083 b/changes/bug15083
index 98d1d0e..2bd0715 100644
--- a/changes/bug15083
+++ b/changes/bug15083
@@ -3,4 +3,8 @@
       failure if a buffer of exactly the wrong layout was passed
       to buf_pullup() at exactly the wrong time. Fixes bug 15083;
       bugfix on 0.2.0.10-alpha. Patch from 'cypherpunks'.
-   
+
+    - Do not assert if the 'data' pointer on a buffer is advanced to the very
+      end of the buffer; log a BUG message instead.  Only assert if it is
+      past that point. Fixes bug 15083; bugfix on 0.2.0.10-alpha.
+
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 7976432..9dfed00 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -2483,7 +2483,14 @@ assert_buf_ok(buf_t *buf)
       total += ch->datalen;
       tor_assert(ch->datalen <= ch->memlen);
       tor_assert(ch->data >= &ch->mem[0]);
-      tor_assert(ch->data < &ch->mem[0]+ch->memlen);
+      tor_assert(ch->data <= &ch->mem[0]+ch->memlen);
+      if (ch->data == &ch->mem[0]+ch->memlen) {
+        static int warned = 0;
+        if (! warned) {
+          log_warn(LD_BUG, "Invariant violation in buf.c related to #15083");
+          warned = 1;
+        }
+      }
       tor_assert(ch->data+ch->datalen <= &ch->mem[0] + ch->memlen);
       if (!ch->next)
         tor_assert(ch == buf->tail);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits