Skip to content

Comments

Fix runtime crashes from missing bounds checks and swapped class files#36

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/search-codebase-for-issues
Draft

Fix runtime crashes from missing bounds checks and swapped class files#36
Copilot wants to merge 2 commits intomainfrom
copilot/search-codebase-for-issues

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

Several latent bugs across the codebase that would cause runtime exceptions under certain inputs, plus a class/filename mismatch that would silently break refactoring and tooling.

Bugs Fixed

  • Signal.csIndexOutOfRangeException in array-subscript parsing loops: Inner while loops incremented the outer for loop variable i to consume dot-split parts without ever checking bounds. Cached the split result and added an early break on bounds overflow:

    // Before
    p1 = Unescape(Escape(LocalName).Split('.')[i]); // no bounds check
    
    // After
    var localNameParts = Escape(LocalName).Split('.');
    if (i >= localNameParts.Length) break;
    p1 = Unescape(localNameParts[i]);
  • Signal.csIndexOutOfRangeException on empty strings: Three sites accessed p1[0] / pNe[0] without guarding against empty strings. Added p1.Length > 0 && guards.

  • BaseOperationOrSignal.csIndexOutOfRangeException in GetFirstChildNotAnd(): Children[0] accessed without verifying Children is non-empty. Added && Children.Count > 0 to the is And check.

  • Move.cs — Negative Cardinality: Children.Count() - 1 returns -1 on an empty collection. Changed to Children.Any() ? Children.Count() - 1 : 0.

  • KopCodeHelper.csInvalidOperationException from .Last() on empty collections: Three call sites called .Last() on Children that could be empty. Fall back to the parent operation's OperationId when no children exist.

  • AddCall.cs / MulCall.cs — Swapped class definitions: AddCall.cs contained MulCall and MulCall.cs contained AddCall. Swapped file contents to restore the correct class-to-file mapping.

Original prompt

This section details on the original issue you should resolve

<issue_title>search codebase for issues</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Copilot AI changed the title [WIP] Search codebase for issues Fix runtime crashes from missing bounds checks and swapped class files Feb 22, 2026
Copilot AI requested a review from jogibear9988 February 22, 2026 08:36
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.

search codebase for issues

2 participants