Skip to content

fix(compat): terminate itoa output reliably - #256

Draft
arazmj wants to merge 1 commit into
fbraz3:mainfrom
arazmj:fix/unix-itoa-output
Draft

fix(compat): terminate itoa output reliably#256
arazmj wants to merge 1 commit into
fbraz3:mainfrom
arazmj:fix/unix-itoa-output

Conversation

@arazmj

@arazmj arazmj commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • replace the Unix itoa implementation's non-portable std::stringbuf::pubsetbuf use with direct conversion
  • preserve base 2-36 conversion and signed decimal behavior, including INT_MIN
  • guarantee that the caller's output buffer is populated and null-terminated

Multiplayer impact

The previous libc++ implementation did not reliably write into the caller-provided buffer. Multi-exit transports therefore built corrupted logical bone names such as ExitStart0..., fell back to the transport position, and desynchronized macOS from Windows while unloading passengers.

With this change, replaying the reported Infantry General Troop Crawler unload changes the macOS frame-7400 CRC from 9C0ABBE5 to the exact Windows CRC F9A12D0B.

Validation

  • built GeneralsX and GeneralsXZH with the macos-vulkan preset
  • verified decimal, negative, INT_MIN, hexadecimal, and invalid-base conversions
  • replayed the captured mixed-platform match through frame 7400

Replace the non-portable stringbuf-backed implementation with direct integer conversion so callers receive a terminated string on Unix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fbraz3
fbraz3 marked this pull request as draft August 17, 2026 04:25
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.

1 participant