Skip to content

Commit 95f8c26

Browse files
authored
sctp: fix 'attempt to add with overflow' panic in dev profile (#393)
1 parent fe8b78d commit 95f8c26

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sctp/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Unreleased
44

5-
* Limit the bytes in the PendingQueue to avoid packets accumulating there uncontrollably [367](https://github.com/webrtc-rs/webrtc/pull/367).
5+
* Fix 'attempt to add with overflow' panic in dev profile [#393](https://github.com/webrtc-rs/webrtc/pull/393)
6+
* Limit the bytes in the PendingQueue to avoid packets accumulating there uncontrollably [#367](https://github.com/webrtc-rs/webrtc/pull/367).
67
* Improve algorithm used to push to pending queue from O(n*log(n)) to O(log(n)) [#365](https://github.com/webrtc-rs/webrtc/pull/365).
78
* Reuse as many allocations as possible when marshaling [#364](https://github.com/webrtc-rs/webrtc/pull/364).
89
* The lock for the internal association was contended badly because marshaling was done while still in a critical section and also tokio was scheduling tasks badly [#363](https://github.com/webrtc-rs/webrtc/pull/363).

sctp/src/queue/reassembly_queue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ impl ReassemblyQueue {
267267
return Err(Error::ErrTryAgain);
268268
}
269269
if cset.ssn == self.next_ssn {
270-
self.next_ssn += 1;
270+
// From RFC 4960 Sec 6.5:
271+
self.next_ssn = self.next_ssn.wrapping_add(1);
271272
}
272273
self.ordered.remove(0)
273274
} else {
@@ -314,7 +315,7 @@ impl ReassemblyQueue {
314315

315316
// Finally, forward next_ssn
316317
if sna16lte(self.next_ssn, last_ssn) {
317-
self.next_ssn = last_ssn + 1;
318+
self.next_ssn = last_ssn.wrapping_add(1);
318319
}
319320
}
320321

0 commit comments

Comments
 (0)