Skip to content

Conversation

@themuffinator
Copy link
Owner

Summary

  • add a reusable SetupTestEnvironment helper for CTF flag state tests
  • reset level, globals, and entity storage before running test scenarios
  • centralize stub imports and entity counts to avoid residual state across tests

Testing

  • not run (not requested)

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
g_next_entity = 0;
std::memset(g_entity_storage, 0, sizeof(g_entity_storage));
std::memset(&level, 0, sizeof(level));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid memset on level_locals_t

SetupTestEnvironment zeroes level with std::memset(&level, 0, sizeof(level)), but level_locals_t includes non-trivial members such as the std::string entstring/match_id fields in src/g_local.h around lines 1703-1722. Blanking the object like this is undefined behaviour and can corrupt those strings, leading to crashes when destructors run or any later use after the environment reset. Reset specific fields or reconstruct the object instead of raw memset.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants