Skip to content

Commit

Permalink
Add checks to maps that are too small.
Browse files Browse the repository at this point in the history
fixes ticket:2135

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/2.3@11585 4a71c877-e1ca-e34f-864e-861f7616d084
(cherry picked from commit 43570ae)
  • Loading branch information
buginator committed Oct 19, 2010
1 parent c71700b commit baab97f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ BOOL mapNew(UDWORD width, UDWORD height)

if (width*height > MAP_MAXAREA)
{
debug(LOG_ERROR, "map too large : %u %u", width, height);
debug(LOG_ERROR, "Map too large : %u %u", width, height);
return false;
}

if (width <=1 || height <=1)
{
debug(LOG_ERROR, "Map is too small : %u, %u", width, height);
return false;
}

Expand Down Expand Up @@ -781,6 +786,12 @@ BOOL mapLoad(char *filename)
goto failure;
}

if (width <=1 || height <=1)
{
debug(LOG_ERROR, "Map is too small : %u, %u", width, height);
return false;
}

/* See if this is the first time a map has been loaded */
ASSERT(psMapTiles == NULL, "Map has not been cleared before calling mapLoad()!");

Expand Down

0 comments on commit baab97f

Please sign in to comment.