Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-81738

Crash: IndexOutOfBoundsException on Tesselating block in world

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 15w38a
    • Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 15w31a, Minecraft 15w31b, Minecraft 15w31c, Minecraft 15w33b, Minecraft 15w33c, Minecraft 15w35e, Minecraft 15w36b, Minecraft 15w36c, Minecraft 15w36d, Minecraft 15w37a
    • None
    • Operating System: Linux (amd64) version 3.13.0-55-lowlatency
      Java Version: 1.7.0_79, Oracle Corporation
      Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Oracle Corporation
    • Confirmed

      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.

        1. crash_15w31b.txt
          4 kB
        2. crash_osx.txt
          4 kB
        3. crash_windows.txt
          4 kB
        4. crash-2015-06-25_14.02.44-client.txt
          4 kB
        5. TesselatingBlockCrash.zip
          3.51 MB

            ProfMobius ProfMobius (Thomas Guimbretiere)
            panda4994 [Mojang] Panda
            Votes:
            36 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: