Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: invalid casting on String.format crashes whole app #14092

Open
1 task done
Informate opened this issue Jul 31, 2024 · 0 comments
Open
1 task done

iOS: invalid casting on String.format crashes whole app #14092

Informate opened this issue Jul 31, 2024 · 0 comments
Labels
bug ios needs triage This issue hasn't been reviewed by maintainers

Comments

@Informate
Copy link

Informate commented Jul 31, 2024

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

String.format on iOS does not perform a casting conversion and in case you enter a number instead of a string the app crashes inexplicably (for those trying to debug the code).
Example:

String.format(“Test %s”,2)

The logs report a segmentation fault:

[ERROR] Application received error: signal error code: 11
[ERROR] (null)
5900 Segmentation fault: 11

Xcode debugger reports:

EXC_BAD_ACCESS (code=1, address=0x3ff00000000000)

Xcode execution stack indicates:

libobjc.A.dylib`objc_opt_respondsToSelector
Foundation`:_NSDescriptionWithStringProxyFunction
CoreFoundation`: __CFStringAppendFormatCore
CoreFoundation`:__CFStringCreateWithFormatAndArgumentsReturningMetadata
TitaniumKit`StringFormatCallback
JavaScriptCore`JSC::callJSCallbackFunction
JavaScriptCore`llint_entry:

FIXING WORKAROUND:
Always cast to string function parameters and use %s in the format string:

String.format(“Test %s”,''+2)

Expected Behavior

Correct casting conversion, or at least throw an exception. Do not crashes the app

Actual behavior

Creashes the whole app

Reproducible sample

String.format(“Test %s”,2)

Steps to reproduce

String.format(“Test %s”,2)

Platform

iOS

SDK version you are using

12.4.0

Alloy version you are using

No response

@Informate Informate added bug needs triage This issue hasn't been reviewed by maintainers labels Jul 31, 2024
@Informate Informate changed the title OS: invalid casting on String.format crashes whole app iOS: invalid casting on String.format crashes whole app Jul 31, 2024
@m1ga m1ga added the ios label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ios needs triage This issue hasn't been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants