TurningWheel / Barony

Barony Open Source Release
http://www.baronygame.com/
Other
500 stars 130 forks source link

BUG: Some iterator out-of-bound access bugs #836

Closed megumin9 closed 5 months ago

megumin9 commented 5 months ago

In file src/ui/GameUI.cpp, line 27414:

else if ( xpProgressEndCap->path == playerXPCapPaths[player.playernum][4] )

Whether the variable player.playernum is xpPathNum in fact, otherwise player.playernum may be greater than the size of the playerXPCapPaths.

Then in file src/interface/bookgui.cpp, line 223:

int numPages = allBooks[bookIndex].formattedPages.size();

If the variable bookindex is greater than the size of the allBooks, the allBooks is not empty, and the variable bBookOpen is true, then the program will not return in line 193. Then, in line 223, the access of the allBooks will be out-of-bound.

SheridanR commented 5 months ago

Sorry, have you observed these happen before?