Skip to content

Commit

Permalink
fix byte overflow when defragmenting chunks with more than 520KB of data
Browse files Browse the repository at this point in the history
  • Loading branch information
Querz committed Jun 9, 2023
1 parent cbc0515 commit bca4899
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/querz/mcaselector/io/mca/MCAFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ public void deFragment(File dest) throws IOException {
// loop over all offsets, readHeader the raw byte data (complete sections) and write it to new file
for (int i = 0; i < offsets.length; i++) {
// don't do anything if this chunk is empty
if (offsets[i] == 0 || sectors[i] <= 0) {
if (offsets[i] == 0 || sectors[i] == 0) {
skippedChunks++;
continue;
}

int sectors = this.sectors[i];
int sectors = this.sectors[i] & 0xFF;

// write offset and sector size to tmp file
rafTmp.seek(i * 4L);
Expand Down

0 comments on commit bca4899

Please sign in to comment.