Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Fix API crash when passing invalid monster type to FamilyFromType#5631

Open
aidanvalero wants to merge 1 commit intocuberite:experimentalfrom
aidanvalero:fix/issue-5442-monster-family-crash
Open

Fix API crash when passing invalid monster type to FamilyFromType#5631
aidanvalero wants to merge 1 commit intocuberite:experimentalfrom
aidanvalero:fix/issue-5442-monster-family-crash

Conversation

@aidanvalero
Copy link

Fixed server crash when Lua plugins pass invalid entity types tocMonster:FamilyFromType(). Previously, calling this with invalid values like-1 would crash the server.

Root Cause

  • FamilyFromType() had no input validation for entity types
  • Switch statement didn't handle out-of-range or negative values
  • Invalid types fell through toUNREACHABLE() macro which triggers crash
  • Lua API allows passing any integer, including invalid values

Security Impact

Before: Malicious plugins could crash the server withcMonster:FamilyFromType(-1)
After: Invalid types returnmfNoSpawn gracefully

Changes

  • Monster.cpp: Added validation check at start ofFamilyFromType()
  • ReturnsmfNoSpawn foretInvalid or negative entity types
  • Prevents crash while maintaining expected behavior

Testing

  • Normal mob types: Still work correctly ✓
  • Invalid types (-1, out-of-range): ReturnmfNoSpawn instead of crashing ✓
  • Lua API fuzzing: No longer triggers crash ✓

Fixes#5442

…berite#5442)Prevents server crash when Lua plugins pass invalid entity types (e.g., -1)to cMonster:FamilyFromType(). Previously, invalid types would fall throughthe switch statement to UNREACHABLE() macro, causing a crash.Root Cause:- FamilyFromType() had no validation for invalid entity types- Switch statement didn't handle out-of-range or negative values- Lua API allows passing any integer, including invalid values- UNREACHABLE() macro at end of switch triggers assertion/crashFix:- Added validation check at function start- Returns mfNoSpawn for invalid entity types (etInvalid or negative values)- Prevents crash while maintaining expected behaviorTesting:- Normal mob types still work correctly- Invalid types (-1, out-of-range) return mfNoSpawn instead of crashing- Lua API fuzzing no longer triggers crashFixescuberite#5442
@aidanvaleroaidanvaleroforce-pushed thefix/issue-5442-monster-family-crash branch from3e769ea toe5bd44eCompareJanuary 23, 2026 01:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@aidanvalero

[8]ページ先頭

©2009-2026 Movatter.jp