summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 19:31:17 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 19:31:17 +0000
commit9a8456c6c95f5d95c568664ba5adaeb466cfbb0d (patch)
tree701da4a4dd0a8c8f847ba3f8dc3dcca2fa6474b8
parent2e70210586ecc2c201460947802039beb12aa69b (diff)
downloadmana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.tar.gz
mana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.tar.bz2
mana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.tar.xz
mana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.zip
Fixed crash when map layer has too many tiles.
-rw-r--r--ChangeLog2
-rw-r--r--src/resources/mapreader.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 580fbca7..70ae300b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,8 @@
works around an initialization bug.
* data/help/index.txt, data/help/windows.txt: Included some
documentation for the shortcut window by Vq.
+ * src/resources/mapreader.cpp: Fixed crash when map layer has too many
+ tiles.
2008-08-28 Philipp Sehmisch <tmw@crushnet.org>
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 328b66e0..af3fc0ef 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -407,7 +407,13 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
setTile(map, layer, x, y, 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);
}