Prevent undefined shift in TimestampWrapAroundHandler::Unwrap
If num_wrap_ is zero this will result in a left shift of a negative number, which is undefined behaviour. Bug: webrtc:11742 Change-Id: I4a6ac448c5af82e15beb25ed55c16bab26e6ee5f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178441 Commit-Queue: Dan Minor <dminor@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31608}
This commit is contained in:
parent
1ff3c584cd
commit
27398d6632
@ -247,7 +247,7 @@ int64_t TimestampWrapAroundHandler::Unwrap(uint32_t ts) {
|
||||
++num_wrap_;
|
||||
} else if ((ts - last_ts_) > 0xf0000000) {
|
||||
// Backwards wrap. Unwrap with last wrap count and don't update last_ts_.
|
||||
return ts + ((num_wrap_ - 1) << 32);
|
||||
return ts + (num_wrap_ - 1) * (int64_t{1} << 32);
|
||||
}
|
||||
|
||||
last_ts_ = ts;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user