[or-cvs] r13633: Log message to try to detect error in buffers.c (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Feb 20 23:38:57 UTC 2008


Author: nickm
Date: 2008-02-20 18:38:57 -0500 (Wed, 20 Feb 2008)
New Revision: 13633

Modified:
   tor/trunk/
   tor/trunk/src/or/buffers.c
Log:
 r18279 at catbus:  nickm | 2008-02-20 18:38:48 -0500
 Log message to try to detect error in buffers.c



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r18279] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c	2008-02-20 23:38:55 UTC (rev 13632)
+++ tor/trunk/src/or/buffers.c	2008-02-20 23:38:57 UTC (rev 13633)
@@ -1020,8 +1020,17 @@
   const chunk_t *chunk;
   int pos;
   tor_assert(out);
-  if (out->chunk)
+  if (out->chunk) {
+    if (!(out->pos < (off_t)out->chunk->datalen)) {
+      log_warn(LD_BUG, "About to assert. %p, %d, %d, %p, %d.",
+               out, (int)out->pos,
+               (int)out->chunk_pos, out->chunk,
+               out->chunk?(int)out->chunk->datalen : (int)-1
+               );
+      /*XXXX020 remove this once the bug it detects is fixed. */
+    }
     tor_assert(out->pos < (off_t)out->chunk->datalen);
+  }
   pos = out->pos;
   for (chunk = out->chunk; chunk; chunk = chunk->next) {
     char *cp = memchr(chunk->data+pos, ch, chunk->datalen-pos);



More information about the tor-commits mailing list