summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLloyd Bryant <lloyd_bryant@netzero.net>2008-08-29 01:36:21 +0000
committerLloyd Bryant <lloyd_bryant@netzero.net>2008-08-29 01:36:21 +0000
commitaf742ceb85512edd1d6883a5ea4f4188e64725be (patch)
tree0772f1ec5a8c741337c5232669ea1454f735fb23
parentb16c29acb5d625df121f5c6aa8ea60a2943845c9 (diff)
downloadmana-af742ceb85512edd1d6883a5ea4f4188e64725be.tar.gz
mana-af742ceb85512edd1d6883a5ea4f4188e64725be.tar.bz2
mana-af742ceb85512edd1d6883a5ea4f4188e64725be.tar.xz
mana-af742ceb85512edd1d6883a5ea4f4188e64725be.zip
Added fix from TMW to prevent crash if a map layer has too many tiles
-rw-r--r--ChangeLog5
-rw-r--r--src/resources/mapreader.cpp8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b4042915..9a391194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-28 Lloyd Bryant ("Sanga") <sanga@aethyra.com>
+
+ * Patch to prevent crash if a map layer has too many
+ tiles (From TMW svn, r4544)
+
2008-08-21 Lloyd Bryant ("Sanga") <sanga@aethyra.com>
* Added configuration option "EnableSync" that causes
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 3dbaefde..e2b47e66 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -378,7 +378,13 @@ MapReader::readLayer(xmlNodePtr node, Map *map, int layer)
map->setTileWithGid(x, y, layer, gid);
x++;
- if (x == w) {x = 0; y++;}
+ if (x == w) {
+ x = 0; y++;
+
+ // When we're done, don't crash on too much data
+ if (y == h)
+ break;
+ }
}
free(binData);
}