mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Make some assertions nonfatal to help prevent bug23690 recurrence.
This commit is contained in:
parent
4e6374c26b
commit
b0ddaac074
3 changed files with 16 additions and 4 deletions
4
changes/bug23690_additional_032
Normal file
4
changes/bug23690_additional_032
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
o Minor features (robustness):
|
||||||
|
- Change several fatal assertions when flushing buffers into
|
||||||
|
non-fatal assertions, to prevent any recurrence of 23690.
|
||||||
|
|
|
@ -648,8 +648,12 @@ buf_flush_to_socket(buf_t *buf, tor_socket_t s, size_t sz,
|
||||||
size_t flushed = 0;
|
size_t flushed = 0;
|
||||||
tor_assert(buf_flushlen);
|
tor_assert(buf_flushlen);
|
||||||
tor_assert(SOCKET_OK(s));
|
tor_assert(SOCKET_OK(s));
|
||||||
tor_assert(*buf_flushlen <= buf->datalen);
|
if (BUG(*buf_flushlen > buf->datalen)) {
|
||||||
tor_assert(sz <= *buf_flushlen);
|
*buf_flushlen = buf->datalen;
|
||||||
|
}
|
||||||
|
if (BUG(sz > *buf_flushlen)) {
|
||||||
|
sz = *buf_flushlen;
|
||||||
|
}
|
||||||
|
|
||||||
check();
|
check();
|
||||||
while (sz) {
|
while (sz) {
|
||||||
|
|
|
@ -142,8 +142,12 @@ buf_flush_to_tls(buf_t *buf, tor_tls_t *tls, size_t flushlen,
|
||||||
size_t flushed = 0;
|
size_t flushed = 0;
|
||||||
ssize_t sz;
|
ssize_t sz;
|
||||||
tor_assert(buf_flushlen);
|
tor_assert(buf_flushlen);
|
||||||
tor_assert(*buf_flushlen <= buf->datalen);
|
if (BUG(*buf_flushlen > buf->datalen)) {
|
||||||
tor_assert(flushlen <= *buf_flushlen);
|
*buf_flushlen = buf->datalen;
|
||||||
|
}
|
||||||
|
if (BUG(flushlen > *buf_flushlen)) {
|
||||||
|
flushlen = *buf_flushlen;
|
||||||
|
}
|
||||||
sz = (ssize_t) flushlen;
|
sz = (ssize_t) flushlen;
|
||||||
|
|
||||||
/* we want to let tls write even if flushlen is zero, because it might
|
/* we want to let tls write even if flushlen is zero, because it might
|
||||||
|
|
Loading…
Add table
Reference in a new issue