++ if (currentStat->value < previousStat->value &&
++ previousStat->value <= MAX_UINT32) {
++ valueDelta = (uint32)(currentStat->value) -
++ (uint32)(previousStat->value);
I'm not sure I follow how this is correct. The casting seems dubious,
but acceptable since previousStat->value fits in 32 bits (we just
checked it's less than MAX_UINT32) and currentStat->value has also been
verified to be less than that.
But if this has happened because currentStat->value wrapped around 32
bits, then surely the correct valueDelta is currentStat->value +
(MAX_UINT32 - previousStat->value)? If previousStat->value was
MAX_UINT32 for example, and currentStat->value is now 0, then the
valueDelta should be 1. But (0 - MAX_UINT32) will surely get promoted
and then end up being assigned to a double as a negative number.
What am I missing?
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1793219
Title:
open-vm-tools guest stats overflow
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/open-vm-tools/+bug/1793219/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs