Skip to content

fix: count active Crowd agents without null writes - #513

Open
xsploit wants to merge 1 commit into
isaac-mason:mainfrom
xsploit:fix/crowd-active-agent-count
Open

fix: count active Crowd agents without null writes#513
xsploit wants to merge 1 commit into
isaac-mason:mainfrom
xsploit:fix/crowd-active-agent-count

Conversation

@xsploit

@xsploit xsploit commented Aug 5, 2026

Copy link
Copy Markdown

What

Fixes Crowd.getActiveAgentCount() by iterating Crowd slots and counting active agents directly.

Why

The current wrapper calls:

crowd->getActiveAgents(NULL, crowd->getAgentCount())

dtCrowd::getActiveAgents writes each active agent pointer into the supplied output array. Passing NULL therefore writes through a null pointer whenever the Crowd contains an active agent. In WASM this can corrupt low linear memory instead of failing at the call site.

Testing

  • yarn build:packages
  • yarn test (6/6 tests plus CJS/ESM node smoke tests)
  • regression fills a 512-agent Crowd, verifies the active count, removes every agent, and verifies zero

This is independent of polygon-reference width and TileCache streaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant