Guard the group-loot division by zero #1

Merged
yrtria merged 1 commit from fix/group-zero-guard into main 2026-09-03 11:21:54 -06:00
Owner

Upstream compiles clean against AzerothCore efe123fab (2026-08-14). It uses the pre-2024 single-argument script constructors, which still work -- PlayerScript::PlayerScript explicitly enables all hooks when the hook list is empty -- and OnLootMoney, OnPlayerCompleteQuest and OnAfterConfigLoad all still match their base signatures.

Change

OnLootMoney counts group members within loot reward distance, then does gold / membersInRange with no guard. A group where no member passes the distance check divides by zero and raises SIGFPE, taking worldserver down. The looter normally counts themselves, so this is latent rather than live -- but the guard costs nothing.

Also hoists the LootMultiplier < 1 check above the member loop (skips the walk entirely when the module is configured off) and drops the now-redundant second test in the solo branch.

Verification

clang++ -fsyntax-only against the live build's own flags: clean. Not built or run.

Note, not a code issue

This fires Guild::HandleMemberDepositMoney -- a DB write plus a bank log row -- on every money loot and every quest turn-in, including bots. With 22 guilds and 314 guild members on this realm, most of them bots, that is real added write load on a VM tuned for playerbot load. Worth watching after the build rather than changing here.

Upstream compiles clean against AzerothCore `efe123fab` (2026-08-14). It uses the pre-2024 single-argument script constructors, which still work -- `PlayerScript::PlayerScript` explicitly enables all hooks when the hook list is empty -- and `OnLootMoney`, `OnPlayerCompleteQuest` and `OnAfterConfigLoad` all still match their base signatures. ## Change `OnLootMoney` counts group members within loot reward distance, then does `gold / membersInRange` with no guard. A group where no member passes the distance check divides by zero and raises SIGFPE, taking worldserver down. The looter normally counts themselves, so this is latent rather than live -- but the guard costs nothing. Also hoists the `LootMultiplier < 1` check above the member loop (skips the walk entirely when the module is configured off) and drops the now-redundant second test in the solo branch. ## Verification `clang++ -fsyntax-only` against the live build's own flags: clean. Not built or run. ## Note, not a code issue This fires `Guild::HandleMemberDepositMoney` -- a DB write plus a bank log row -- on every money loot and every quest turn-in, **including bots**. With 22 guilds and 314 guild members on this realm, most of them bots, that is real added write load on a VM tuned for playerbot load. Worth watching after the build rather than changing here.
yrtria added 1 commit 2026-09-03 11:21:50 -06:00
OnLootMoney counts group members within loot reward distance, then divides
gold by that count with no guard. If no member passes the distance check the
count stays 0 and the division raises SIGFPE, taking worldserver down. The
looter normally counts themselves so this is a latent rather than live bug,
but the guard is free.

Also hoists the LootMultiplier check above the member loop, which skips the
whole walk when the module is configured off, and drops the now-redundant
second test in the solo branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vTNrJGsprcjdjjjDJD5ZM
yrtria merged commit a457162439 into main 2026-09-03 11:21:54 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: yrtria/mod-guildfunds#1
No description provided.