cortex-command-community / Cortex-Command-Community-Project-Source

[ARCHIVED] Cortex Command - Open Source under GNU AGPL v3 (no game data included)

Home Page:https://cortex-command-community.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Out of Bounds `PieSlice` `Direction` property crashes with no Abort

traunts opened this issue · comments

Describe the bug
PieSlice property Direction can be created with string reference to enums ("Up", "Down" etc.) or their corresponding enum mapping from here:

	/// <summary>
	/// Enumeration and supporting maps for cardinal directions, as well as None and Any.
	/// </summary>
	enum Directions { None = -1, Up, Down, Left, Right, Any };

If a modder provides a direction reference out of this range [-1, 4] then the reader allows it and the game crashes later when creating the PieSlice in question.

To Reproduce
Steps to reproduce the behaviour:

  1. Edit a PieSlice ini declaration to have Direction = 5 (or any parseable int values outside of the range)
    e.g. The Ronin Shovel, L209.
  2. Launch the game, and create/order a shovel. Game hard crashes.

Expected behaviour
The reader should catch and report invalid input directions at load time.

Additional context
The crash occurs with out-of-bounds .at() access in PieMenu::AddPieSlice() at L345.