Repository navigation
Fix off-by-one in RadarMap radarcol bounds checks - #87
Merged
Merged
Conversation
The constructor checked `id > _radarColors.Length` before reading `_radarColors[id]`, so a static whose radar index equals the length of radarcol threw IndexOutOfRangeException at server startup. Use `>=`. RadarMap.Update had no check at all, so editing such a tile (or one past the end) threw from the packet handler. Apply the same check and fallback there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kaczy93
approved these changes
Nov 23, 2026
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.
Problem
RadarMapreads_radarColors[id]after a bounds check that letsid == _radarColors.Lengththrough (>instead of>=). A static whose radar index (Id + 0x4000) is exactly the length of radarcol, with Z at or above the land, makes the server throwIndexOutOfRangeExceptionat startup.RadarMap.Updatehas no check at all, so editing a tile with such an id (or any id past the end) throws from the packet handler and the client is disconnected; during a large scale operation it aborts the operation.Fix
>=instead of>.Update: the same check, with the same log line and0x4000fallback.Testing
ServerLandscape(radarcol of 0x4001, 0x8000 and 0xC000 entries), and checked they are gone. Valid ids keep their color.Shared.TestsandCentrED.Testspass.🤖 Generated with Claude Code