mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-21 05:26:20 +02:00
r18283@catbus: nickm | 2008-02-20 18:58:31 -0500
Fix assertion when searching for a string in an empty chunk. svn:r13634
This commit is contained in:
parent
304bdfdc6b
commit
3b58f9929f
@ -1021,15 +1021,19 @@ buf_find_pos_of_char(char ch, buf_pos_t *out)
|
|||||||
int pos;
|
int pos;
|
||||||
tor_assert(out);
|
tor_assert(out);
|
||||||
if (out->chunk) {
|
if (out->chunk) {
|
||||||
if (!(out->pos < (off_t)out->chunk->datalen)) {
|
if (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. */
|
/*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;
|
pos = out->pos;
|
||||||
for (chunk = out->chunk; chunk; chunk = chunk->next) {
|
for (chunk = out->chunk; chunk; chunk = chunk->next) {
|
||||||
|
Loading…
Reference in New Issue
Block a user