summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 1f0d64d4b3..8c5e2efca5 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -1021,15 +1021,19 @@ buf_find_pos_of_char(char ch, buf_pos_t *out)
int pos;
tor_assert(out);
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
- );
+ if (out->chunk->datalen) {
/*XXXX020 remove this once the bug it detects is fixed. */
+ 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
+ );
+ }
+ tor_assert(out->pos < (off_t)out->chunk->datalen);
+ } else {
+ tor_assert(out->pos == 0);
}
- tor_assert(out->pos < (off_t)out->chunk->datalen);
}
pos = out->pos;
for (chunk = out->chunk; chunk; chunk = chunk->next) {