Repository navigation
Widen Int and UInt arguments in String(localized:) formatting - #40
Merged
Merged
Conversation
Interpolated Int and UInt values are keyed as %lld and %llu, which read 64-bit arguments, but were passed to String(format:) at their native width. On 32-bit Android ABIs (armeabi-v7a) that misaligns every following argument, and a later %@ reads garbage and crashes. Widen them to Int64/UInt64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marcprux
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
String(localized:)keys an interpolatedIntas%lldand aUIntas%llu. Both read 64-bit arguments, but the values were passed toString(format:)at their native width. On 32-bit Android ABIs (armeabi-v7a),Intis 32 bits, so every following argument is misaligned:The
%@then reads garbage and crashes inswift_dynamicCastClass ← _NSFormattingDescription ← String.init. On 64-bit ABIs,IntandInt64have the same size, so nothing changes there.Fix
In
androidLocalizedString, widenInttoInt64andUInttoUInt64before formatting. The stored interpolation values are unchanged, so the SwiftUITextpath, which hands them to Kotlin, is unaffected.Testing
Cross-compiled with
skip android build --arch armv7and checked that the edited file was rebuilt. Not run on a 32-bit device or emulator. No test added, because a regression would not show on arm64 or x86_64.🤖 Generated with Claude Code