-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugiosneeds triageThis issue hasn't been reviewed by maintainersThis issue hasn't been reviewed by maintainers
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugiosneeds triageThis issue hasn't been reviewed by maintainersThis issue hasn't been reviewed by maintainers