Looks like the extended type stuff has triggered an ancient bug.

Please try attached patch and see if you can process bigger maps again.

diff --git a/src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java b/src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java
index 37d5509..b1d6fb2 100644
--- a/src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java
+++ b/src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java
@@ -175,8 +175,10 @@ public class BufferedImgFileWriter implements ImgFileWriter {
 	 * @param length The amount of data.
 	 */
 	private void ensureSize(int length) {
-		if (buf.position() +length > bufferSize - GUARD_SIZE) {
-			bufferSize += GROW_SIZE;
+		int needed = buf.position() + length;
+		if (needed > (bufferSize - GUARD_SIZE)) {
+			while(needed > (bufferSize - GUARD_SIZE))
+				bufferSize += GROW_SIZE;
 			if (bufferSize > 0xffffff) {
 				// Previous message was confusing people, although it is difficult to come
 				// up with something that is strictly true in all situations.
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to