[SPIGOT-1390] CraftChunkData setRegion IllegalArgumentException Created: 01/Jan/16  Updated: 10/Jan/16  Resolved: 03/Jan/16

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ryan Bennitt Assignee: md_5
Resolution: Fixed Votes: 0
Labels: Craftbukkit

Attachments: Text File 0161-Fixed-issues-with-Array.fill-upper-bound-in-setRegio.patch    

 Description   

The setRegion method in CraftChunkData produces IllegalArgumentException for certain inputs, particularly when filling up to the full bounds of a chunk.



 Comments   
Comment by Ryan Bennitt [ 10/Jan/16 ]

I have access! Created pull request for master.

Comment by md_5 [ 03/Jan/16 ]

Please fill in the CLA: http://spigotmc.org/go/cla

Comment by Ryan Bennitt [ 01/Jan/16 ]

Attached patch to fix.

Error in upper bound calculation for Arrays.fill caused by bitwise-or of x-bits overwriting the lowest z-bit, or z-bits overwriting y-bit due to maximum value being 16 (0x10 is the fifth bit, but x and z only have four bits). Changed from bitwise-or to addition to calculate correct upper bound.

Also yMax comparison was failing to fill the top chunk, changed from greater-than-or-equal comparison to greater-than.

Created unit tests

Generated at Tue Apr 08 01:20:42 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.