Skip to content

Fix std::isspace undefined behavior with unsigned char cast#333

Merged
rrivera747 merged 2 commits intorrivera/checkpointHandlingNewRunInfoAtMC2from
copilot/sub-pr-319-yet-again
Feb 12, 2026
Merged

Fix std::isspace undefined behavior with unsigned char cast#333
rrivera747 merged 2 commits intorrivera/checkpointHandlingNewRunInfoAtMC2from
copilot/sub-pr-319-yet-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

std::isspace has undefined behavior when passed negative char values, which can occur on platforms where char is signed and characters have values > 127.

Changes

  • Cast char to unsigned char before passing to std::isspace in GatewaySupervisor.cc
  • Add #include <cctype> for explicit std::isspace declaration

Example

// Before: undefined behavior for negative signed chars
if(varName[0] == '_' || std::isspace(varName[0]) || ...)

// After: safe for all char values [0, 255]
if(varName[0] == '_' || std::isspace(static_cast<unsigned char>(varName[0])) || ...)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: rrivera747 <107584474+rrivera747@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on checkpoint handling for unsigned char usage Fix std::isspace undefined behavior with unsigned char cast Feb 12, 2026
Copilot AI requested a review from rrivera747 February 12, 2026 02:28
@rrivera747 rrivera747 marked this pull request as ready for review February 12, 2026 02:44
@rrivera747 rrivera747 merged commit 549e32c into rrivera/checkpointHandlingNewRunInfoAtMC2 Feb 12, 2026
@rrivera747 rrivera747 deleted the copilot/sub-pr-319-yet-again branch February 12, 2026 02:44
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.

2 participants