mojira.dev
MC-81738

Crash: IndexOutOfBoundsException on Tesselating block in world

When ever I load a certain area of my world the attached crash happens.
If the world is started as a server only the client crashes, but the crash report should speak for itself.

Steps to reproduce:
1. Download the attached world file
2. Log into this world
3. Look down

Description: Tesselating block in world

java.lang.IndexOutOfBoundsException
	at java.nio.Buffer.checkIndex(Buffer.java:538)
	at java.nio.DirectByteBuffer.putFloat(DirectByteBuffer.java:887)
	at bfd.b(SourceFile:414)
	at bge.a(SourceFile:225)
	at bgd.a(SourceFile:67)
	at bht.b(SourceFile:176)
	at bhp.a(SourceFile:78)
	at bho.b(SourceFile:121)
	at bfr.a(SourceFile:842)

Note that this crash might be environment dependent.

How the world got corrupted like this
I had the world open to LAN and when I left it Minecraft hung (MC-72943). After forcing the process to stop and restarting the crash happened when ever joining the world again.

Search disclaimer
The only unresolved issue I could find which might be related to this one is MC-81252, but it has a completely different stack trace. There is many other issues about the same/similar crashes but as they are resolved I just assume that they have different causes.

Potential Fix

The reason for the exception is that a buffer for rendering overflows.

WorldRenderer.java (in MCP)

package net.minecraft.client.renderer;
...
public class WorldRenderer {
	...
	private void growBuffer(int p_178983_1_) {
		LogManager.getLogger().warn("Needed to grow BufferBuilder buffer: Old size " + this.bufferSize * 4 + " bytes, new size " + (this.bufferSize * 4 + p_178983_1_) + " bytes.");
		this.bufferSize += p_178983_1_ / 4;
		ByteBuffer var2 = GLAllocation.createDirectByteBuffer(this.bufferSize * 4);
		this.rawIntBuffer.position(0);
		var2.asIntBuffer().put(this.rawIntBuffer);
		this.byteBuffer = var2;
		this.rawIntBuffer = this.byteBuffer.asIntBuffer();
		this.rawFloatBuffer = this.byteBuffer.asFloatBuffer();
	}

	public void setVertexState(WorldRenderer.State p_178993_1_) {
		this.rawIntBuffer.clear();
		// This call causes the crash. Calling growBuffer() when needed fixes the crash for me.
		this.rawIntBuffer.put(p_178993_1_.func_179013_a());
		this.rawBufferIndex = p_178993_1_.getRawBufferIndex();
		this.vertexCount = p_178993_1_.getVertexCount();
		this.vertexFormat = new VertexFormat(p_178993_1_.func_179016_d());
	}
	...
}

Growing the buffer might be the right fix, but it could also be that the reason why it overflows is a bug in the first place.

Linked issues

Attachments

Comments

Panda4994

Now also confirmed to crash on Windows thanks to Twitter user @Robitobi01 🙂

Panda4994

And Osx is confirmed to crash too thanks to RedstoneSpire 🙂

kumasasa

Confirmed.

Christopher Smith

What's a tesselating block?

kumasasa

"tesselating " is a verb and not a noun. Read that message as IndexOutOfBoundsException on tesselating a block in world

pokechu22

Is the "Open to LAN and minecraft hung" bug MC-71357? Or are you referring to MC-72943? Or another one?

Panda4994

@@unknown MC-72943 seems to be it. Thank you for linking it 🙂

Panda4994

Can confirm for 15w31b. See

[media]
Panda4994

I won't attach a crash report for every new version form now on. But I just tested it for 15w33b and 15w33c. Still happens.

Panda4994

Can confirm for 15w35e. I think the issue is just that a buffer needs to be grown.

James (inactive)

Confirmed for 15w36d.

Djfe

Thank you for fixing it!

I wonder whether he found the reason for the buffer overflow.

anyways now the only thing preventing Panda's mushroom cows from being happy in his farm is:
MC-50367

Supercat McGowen

I am having a similar issue in 1.10.2 on a server called Arkham Network but it is not repetitive

Abdulrahman

got the same issue on 1.10.2

 

Panda4994

migrated

Confirmed

Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 15w31a, Minecraft 15w31b, Minecraft 15w31c, ..., Minecraft 15w35e, Minecraft 15w36b, Minecraft 15w36c, Minecraft 15w36d, Minecraft 15w37a

Minecraft 15w38a

Retrieved