Fix PseudoTcp to handle incoming packets with invalid SEQ field

Previously PseudoTcp::process() didn't handle the case when the peer
sends a packet that's outside of the receive window, which was causing
DCHECK failures in the fuzzer.

BUG=681849

Review-Url: https://codereview.webrtc.org/2640173002
Cr-Commit-Position: refs/heads/master@{#16169}
This commit is contained in:
sergeyu 2017-01-19 10:53:35 -08:00 committed by Commit bot
parent 3cd896c962
commit d74886350e

View File

@ -910,10 +910,14 @@ bool PseudoTcp::process(Segment& seg) {
} else {
uint32_t nOffset = seg.seq - m_rcv_nxt;
rtc::StreamResult result = m_rbuf.WriteOffset(seg.data, seg.len,
nOffset, NULL);
rtc::StreamResult result =
m_rbuf.WriteOffset(seg.data, seg.len, nOffset, NULL);
if (result == rtc::SR_BLOCK) {
// Ignore incoming packets outside of the receive window.
return false;
}
RTC_DCHECK(result == rtc::SR_SUCCESS);
RTC_UNUSED(result);
if (seg.seq == m_rcv_nxt) {
m_rbuf.ConsumeWriteBuffer(seg.len);