Skip to content

Commit

Permalink
chunk/decode.go: Return error if palette size is larger than 32 (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
HashimTheArab authored Aug 15, 2024
1 parent fb5a7f5 commit 990932b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/world/chunk/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ func decodePalettedStorage(buf *bytes.Buffer, e Encoding, pe paletteEncoding) (*
}

size := paletteSize(blockSize)
if size > 32 {
return nil, fmt.Errorf("cannot read paletted storage (size=%v) %T: size too large", blockSize, pe)
}
uint32Count := size.uint32s()

uint32s := make([]uint32, uint32Count)
Expand Down

0 comments on commit 990932b

Please sign in to comment.