зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1587164
- Avoid left shift of negative value in TimestampWrapAroundHandler; r=bwc
The code for handling backwards wraps left shifts num_wrap_ - 1. If num_wrap_ is zero, this results in a left shift of a negative value which is undefined behaviour. This modifies the code to avoid the shift at the cost of an extra multiplication. Differential Revision: https://phabricator.services.mozilla.com/D49609 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a980b29c49
Коммит
188c0c2c70
|
@ -139,7 +139,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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче