PaperMC / PaperMC/Paper

Anti Xray bug on certain chunk formats

Open
#13,834 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage version: 1.21.11
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

everything works fine

Observed/Actual behavior

Unexpected palette resize in ChunkPacketBlockControllerAntiXray

Image
Steps/models to reproduce

When there are two identical block state in a certain section's palette, such as deepslate and deepslate[axis=y] below. These files might be created by some third party softwares.

Image

Then the values passed in this constructor would have two same blockstates

Image

When presetValue is added as the second-to-last element, the palette size at that point is 32 (containing 31 unique states and 1 duplicate state). When presetValue is added as the last element, the calculation of newBits ignores the duplicate element, causing the set that should have 33 elements to be reduced to 32. As a result, the palette resizing cannot be triggered during chunk loading.

Image

Ultimately, when being processed by ChunkPacketBlockControllerAntiXray, the last element that failed to be added results in No Resize Expected.

Plugin and Datapack List

none

Paper version

1.21.11-DEV-c5a2736

Other

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ChunkPacketBlockControllerAntiXray and trace the palette resizing calculation described in the report. Reproduce the case with duplicate block states, including deepslate and deepslate[axis=y], and verify that adding the preset value triggers resizing when the palette reaches the relevant size without dropping an element.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.