]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make the assert related to 15083 a tiny bit more tolerant
authorNick Mathewson <nickm@torproject.org>
Tue, 3 Mar 2015 21:25:26 +0000 (22:25 +0100)
committerNick Mathewson <nickm@torproject.org>
Tue, 3 Mar 2015 21:25:26 +0000 (22:25 +0100)
changes/bug15083
src/or/buffers.c

index 98d1d0e5355a0fb9f24432d77455d574b28822aa..2bd0715dfc81332416781a7690cb460ca4ce899e 100644 (file)
@@ -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.
+
index 7976432793a7a5cb86f14712cee455c29b7a39c6..9dfed007daece767cdf65bda36e8721aed40b22b 100644 (file)
@@ -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);