Skip to content

fix(script): Reject invalid parameter data when loading map scripts - #3578

Open
stephanmeesters wants to merge 1 commit into
TheSuperHackers:mainfrom
stephanmeesters:fix/map-script-parameters
Open

stephanmeesters wants to merge 1 commit into
TheSuperHackers:mainfrom
stephanmeesters:fix/map-script-parameters

Conversation

@stephanmeesters

@stephanmeesters stephanmeesters commented Oct 23, 2026 •

Copy link
Copy Markdown

Improves validation of parameter counts during map loading. Looks at Scripts.cpp only.

Todo

  • Replicate in Generals

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a110a22-f61e-49ab-9d16-43b693bdbc35
📥 Commits

Reviewing files that changed from the base of the PR and between f02fcd3 and 4dd32d3.

📒 Files selected for processing: 1
  • GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Script parsing now rejects invalid condition and action parameter counts, invalid legacy condition counts, and kind-of indices outside the valid range.

Changes

Script data validation

Layer / File(s) Summary
Validate script parameters
GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp
Condition and action parsing reject counts below zero or above MAX_PARMS. Version-1 legacy condition data must contain exactly two parameters before the surface parameter is added. Kind-of parsing rejects indices outside [0, KINDOF_COUNT).

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: xezon, bobtista

Merge Risk: ⚪ Minimal · up to 4dd32

No actionable merge-blocking risk is established for this validation-only change.

Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed The description explains that the change improves parameter-count validation during map loading and identifies the affected file. It is directly related to the changeset.
Title check Passed The title clearly and concisely describes the main change: rejecting invalid parameter data when loading map scripts.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stephanmeesters stephanmeesters added Gen Relates to Generals Fix Is fixing something, but is not user facing ZH Relates to Zero Hour labels Oct 23, 2026
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Adds checks in Scripts.cpp before loading invalid map-script parameters.

  • Map script loading rejects parameter counts outside their allowed shape.
  • Out-of-range integer kind-of values stop map loading.

stephanmeesters accepted the memory-leak risk as out of scope because existing throws have the same problem. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "fix(script): Reject invalid parameter da..." · Reviewed by Greptile

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this all? There no other validations missing in this file?

@stephanmeesters

Copy link
Copy Markdown
Author

Is this all? There no other validations missing in this file?

According to Claude this was it.

@stephanmeesters

Copy link
Copy Markdown
Author

I'm going to be away for a few weeks, perhaps someone else can pick this up.

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

Labels

Fix Is fixing something, but is not user facing Gen Relates to Generals ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants