mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 12:53:53 +00:00
Fix INT_MIN trade exploit (Fixes #2096)
This commit is contained in:
parent
6b88f5f33e
commit
d5768af952
1 changed files with 4 additions and 0 deletions
|
@ -89,6 +89,7 @@ namespace MWGui
|
|||
mDecreaseButton->eventMouseButtonReleased += MyGUI::newDelegate(this, &TradeWindow::onBalanceButtonReleased);
|
||||
|
||||
mTotalBalance->eventValueChanged += MyGUI::newDelegate(this, &TradeWindow::onBalanceValueChanged);
|
||||
mTotalBalance->setMinValue(INT_MIN+1); // disallow INT_MIN since abs(INT_MIN) is undefined
|
||||
|
||||
setCoord(400, 0, 400, 300);
|
||||
}
|
||||
|
@ -448,6 +449,9 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::onIncreaseButtonTriggered()
|
||||
{
|
||||
// prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined
|
||||
if (mCurrentBalance == INT_MAX || mCurrentBalance == INT_MIN+1)
|
||||
return;
|
||||
if(mCurrentBalance<=-1) mCurrentBalance -= 1;
|
||||
if(mCurrentBalance>=1) mCurrentBalance += 1;
|
||||
updateLabels();
|
||||
|
|
Loading…
Reference in a new issue