Repository navigation
Avoid integer overflow in NBT size limits - #1623
Open
kripypastishka wants to merge 1 commit into
Open
kripypastishka wants to merge 1 commit into
kripypastishka wants to merge 1 commit into
Conversation
|
Is this AI |
booky10
approved these changes
Nov 9, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent integer overflow in NBT size accounting
Summary
Use overflow-safe arithmetic to check the configured maximum size in NBTLimiter.increment(int).
Root cause
The existing check adds two signed int values before comparing the result to maxBytes. With unusually large custom limits, overflow can invalidate the comparison.
Changes
Tests
Three JUnit tests were added: an overflow case, reaching the exact maximum, and rejecting negative increments. A focused standalone Java 21 arithmetic reproduction confirmed the defect and corrected check.
The default NBT size limit is much smaller; no network exploit has been demonstrated. The full Gradle build and new repository tests have not been executed. Please run ./gradlew :api:test.
Compatibility
No API, protocol, schema or configuration default changes.
Please review and test before merging.