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

Chunk data packet can create a buffer 1-16 bytes too large

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre9, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w43b, 1.15.1, 1.15.2
    • Fix Version/s: None
    • Labels:
    • Confirmation Status:
      Confirmed
    • Category:
      Networking

      Description

      The direct palette in the chunk data packet no longer writes anything to the packet buffer (instead of just writing a 0); this changed in 17w47a (the flattening). However, they still claim to have a serialized size of 1 byte. This means that the buffer allocated for the chunk data packet has between 1 and 16 extra bytes, one for the palette for each chunk section using the global palette.

      In 1.12.2, what MCP calls BlockStatePaletteRegistry has this:

          public void read(PacketBuffer buf)
          {
              buf.readVarInt();
          }
      
          public void write(PacketBuffer buf)
          {
              buf.writeVarInt(0);
          }
      
          public int getSerializedSize()
          {
              return PacketBuffer.getVarIntSize(0);
          }
      

      In the current 1.13 snapshots, it instead has this:

          public void read(PacketBuffer buf)
          {
          }
      
          public void write(PacketBuffer buf)
          {
          }
      
          public int getSerializedSize()
          {
              return PacketBuffer.getVarIntSize(0);
          }
      

      The return PacketBuffer.getVarIntSize(0) should be changed to return 0.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            pokechu22 [Mod] Pokechu22
            Votes:
            8 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              CHK: