Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BUGFIX a handful of OOB #1844

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Source/drlg_l3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,19 @@ static void DRLG_L3River()
rx = 0;
ry = 0;
i = 0;
while ((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && i < 100) {
while ((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && i < 100) { /// BUGFIX: OOB `while (ry < DMAXY && (`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the BUGFIX comment cut short? It ends with && (

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was meant to sign that it should just continue as previously
`while (ry < DMAXY && (dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && i < 100) {v

rx = random_(0, DMAXX);
ry = random_(0, DMAXY);
i++;
while ((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && ry < DMAXY) {
while ((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && ry < DMAXY) { /// BUGFIX: OOB `while (ry < DMAXY && (`
rx++;
if (rx >= DMAXX) {
rx = 0;
ry++;
}
}
}
/// BUGFIX: OOB `if (ry >= DMAXY) continue;`
if (i >= 100) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/lighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,10 @@ void DoVision(int nXPos, int nYPos, int nRadius, BOOL doautomap, BOOL visible)
}
break;
}
if (nCrawlX >= 0 && nCrawlX <= MAXDUNX && nCrawlY >= 0 && nCrawlY <= MAXDUNY) {
if (nCrawlX >= 0 && nCrawlX <= MAXDUNX && nCrawlY >= 0 && nCrawlY <= MAXDUNY) { /// BUGFIX: OOB `< MAXDUNX` && `< MAXDUNY`
nBlockerFlag = nBlockTable[dPiece[nCrawlX][nCrawlY]];
if (!nBlockTable[dPiece[x1adj + nCrawlX][y1adj + nCrawlY]]
|| !nBlockTable[dPiece[x2adj + nCrawlX][y2adj + nCrawlY]]) {
if (!nBlockTable[dPiece[x1adj + nCrawlX][y1adj + nCrawlY]] /// BUGFIX: OOB `x1adj + nCrawlX >= 0 && x1adj + nCrawlX < MAXDUNX && y1adj + nCrawlY >= 0 && y1adj + nCrawlY < MAXDUNY`
|| !nBlockTable[dPiece[x2adj + nCrawlX][y2adj + nCrawlY]]) { /// BUGFIX: OOB `x2adj + nCrawlX >= 0 && x2adj + nCrawlX < MAXDUNX && y2adj + nCrawlY >= 0 && y2adj + nCrawlY < MAXDUNY`
if (doautomap) {
if (dFlags[nCrawlX][nCrawlY] >= 0) {
SetAutomapView(nCrawlX, nCrawlY);
Expand Down