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

addingPercentEncoding(withAllowedCharacters:) crashing instead of returning nil #5161

Open
BalthazarJam opened this issue Jan 21, 2025 · 3 comments

Comments

@BalthazarJam
Copy link

BalthazarJam commented Jan 21, 2025

Description

We are seeing crashes from the addingPercentEncoding(withAllowedCharacters:) method. From the comment in the NSStringAPI.swift file, I'm not sure what's going on with that method, but wonder if perhaps on the rare occasion that malloc() fails and returns NULL, this is not being successfully translated into a nil return.

I also see that comment has not been modified in 6 years. Any plans to address the "FIX:"?

Reproduction

func encodeString(_ string: String) -> String {
   var allowedCharSet = CharacterSet.urlQueryAllowed
   allowedCharSet.remove(charactersIn: "!*'\"();:@&=+$,/?%#[]% ")
   return string.addingPercentEncoding(withAllowedCharacters: allowedCharSet) ?? string
}

Stack dump

Incident Identifier: 5B47C421-D8B6-49C9-83CE-6AC70579D25E
Distributor ID:      com.apple.AppStore
Hardware Model:      iPhone16,2
AppStoreTools:       16C5031b
AppVariant:          1:iPhone16,2:18
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]

Date/Time:           2025-01-16 02:24:48.8735 +0100
Launch Time:         2025-01-16 01:37:36.6761 +0100
OS Version:          iPhone OS 18.1.1 (22B91)
Release Type:        User
Baseband Version:    2.20.03
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4345217024
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   102fec000-102ff0000 [   16K] r-x/r-x SM=COW  /var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Casino
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [3287]

Triggered by Thread:  5



Thread 0:
0   libswiftCore.dylib            	0x000000019814edf4 _print_unlocked<A, B>(_:_:) + 540 (<compiler-generated>:0)
1   Casino                        	0x000000010310b420 AccessibilityIdentifying.identifier.getter + 108 (AccessibilityIdentifying.swift:12)
2   Casino                        	0x00000001036faf44 protocol witness for AccessibilityIdentifying.identifier.getter in conformance LimitsView.LimitViewIdentifier + 24 (<compiler-generated>:0)
3   Casino                        	0x00000001036faf44 specialized View.accessibilityIdentifier(_:) + 64 (LimitsView.swift:95)
4   Casino                        	0x00000001036faf44 closure swiftlang/swift#1 in closure swiftlang/swift#1 in LimitsView.header.getter + 716
5   Casino                        	0x00000001036fab70 specialized HStack.init(alignment:spacing:content:) + 28 (<compiler-generated>:0)
6   Casino                        	0x00000001036fab70 closure swiftlang/swift#1 in LimitsView.header.getter + 312
7   SwiftUICore                   	0x00000002598160c4 closure swiftlang/swift#1 in VStack.init(alignment:spacing:content:) + 196 (VStack.swift:58)
8   SwiftUICore                   	0x0000000259af31a0 _VariadicView.Tree.init(_:content:) + 256 (VariadicView.swift:69)
9   SwiftUICore                   	0x0000000259815ff4 VStack.init(alignment:spacing:content:) + 92 (VStack.swift:55)
10  Casino                        	0x00000001036f8af8 LimitsView.header.getter + 92 (LimitsView.swift:82)
11  Casino                        	0x00000001036f8af8 closure swiftlang/swift#1 in LimitsView.body.getter + 468 (LimitsView.swift:24)
12  Casino                        	0x00000001036f8718 specialized VStack.init(alignment:spacing:content:) + 28 (<compiler-generated>:0)
13  Casino                        	0x00000001036f8718 LimitsView.body.getter + 264
14  SwiftUICore                   	0x0000000259a036dc specialized ViewBodyAccessor.updateBody(of:changed:) + 1240 (CustomView.swift:69)
15  SwiftUICore                   	0x0000000259b0fdac closure swiftlang/swift#1 in DynamicBody.updateValue() + 600 (DynamicProperty.swift:474)
16  SwiftUICore                   	0x0000000259b0f7c0 DynamicBody.updateValue() + 928 (DynamicProperty.swift:466)
17  SwiftUICore                   	0x0000000259bafcc0 partial apply for implicit closure swiftlang/swift#1 in closure swiftlang/swift#1 in closure swiftlang/swift#1 in Attribute.init<A>(_:) + 32 (<compiler-generated>:0)
18  AttributeGraph                	0x00000001c5d1050c AG::Graph::UpdateStack::update() + 540 (ag-graph-update.cc:583)
19  AttributeGraph                	0x00000001c5d100d0 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 424 (ag-graph-update.cc:712)
20  AttributeGraph                	0x00000001c5d0fca4 AG::Subgraph::update(unsigned int) + 848 (ag-subgraph.cc:758)
21  SwiftUICore                   	0x0000000259cf6a58 GraphHost.flushTransactions() + 860 (GraphHost.swift:646)
22  SwiftUI                       	0x000000019e453478 closure swiftlang/swift#1 in _UIHostingView._renderForTest(interval:) + 24 (_UIHostingView.swift:368)
23  SwiftUICore                   	0x000000025a0954fc partial apply for closure swiftlang/swift#1 in ViewGraphDelegate.updateGraph<A>(body:) + 28 (<compiler-generated>:0)
24  SwiftUICore                   	0x000000025a0795d8 ViewRendererHost.updateViewGraph<A>(body:) + 120 (ViewRendererHost.swift:102)
25  SwiftUICore                   	0x000000025a07f3ec ViewGraphDelegate.updateGraph<A>(body:) + 84 (ViewGraph.swift:28)
26  SwiftUI                       	0x000000019e453444 closure swiftlang/swift#1 in closure swiftlang/swift#1 in closure swiftlang/swift#1 in _UIHostingView.beginTransaction() + 172 (_UIHostingView.swift:368)
27  SwiftUI                       	0x000000019e45bddc partial apply for closure swiftlang/swift#1 in closure swiftlang/swift#1 in closure swiftlang/swift#1 in _UIHostingView.beginTransaction() + 24 (<compiler-generated>:0)
28  SwiftUICore                   	0x0000000259b13fd0 closure swiftlang/swift#1 in static Update.ensure<A>(_:) + 56 (Update.swift:165)
29  SwiftUICore                   	0x0000000259b12dd4 static Update.ensure<A>(_:) + 100 (Update.swift:162)
30  SwiftUI                       	0x000000019e45bdb4 partial apply for closure swiftlang/swift#1 in closure swiftlang/swift#1 in _UIHostingView.beginTransaction() + 80 (<compiler-generated>:0)
31  SwiftUICore                   	0x0000000259b12ed4 thunk for @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
32  SwiftUICore                   	0x000000025a007e0c specialized closure swiftlang/swift#1 in static NSRunLoop.addObserver(_:) + 144 (RunLoopUtils.swift:21)
33  CoreFoundation                	0x0000000199a5a1f4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1802)
34  CoreFoundation                	0x0000000199a59f98 __CFRunLoopDoObservers + 552 (CFRunLoop.c:1915)
35  CoreFoundation                	0x0000000199a89028 __CFRunLoopRun + 948 (CFRunLoop.c:2997)
36  CoreFoundation                	0x0000000199a88830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)
37  GraphicsServices              	0x00000001e5a681c4 GSEventRunModal + 164 (GSEvent.c:2196)
38  UIKitCore                     	0x000000019c5eeeb0 -[UIApplication _run] + 816 (UIApplication.m:3844)
39  UIKitCore                     	0x000000019c69d5b4 UIApplicationMain + 340 (UIApplication.m:5496)
40  Casino                        	0x0000000102ff0a14 main + 68 (AppDelegate.swift:11)
41  dyld                          	0x00000001bf476ec8 start + 2724 (dyldMain.cpp:1334)

Thread 1:
0   libsystem_kernel.dylib        	0x00000001e9e4a688 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001e9e4dd98 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001e9e4dcb0 mach_msg_overwrite + 424 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001e9e4dafc mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x0000000199a89a84 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)
5   CoreFoundation                	0x0000000199a89130 __CFRunLoopRun + 1212 (CFRunLoop.c:3021)
6   CoreFoundation                	0x0000000199a88830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)
7   Foundation                    	0x0000000198730500 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                    	0x0000000198730350 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                     	0x000000019c602358 -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1241)
10  Foundation                    	0x00000001987416c8 __NSThread__start__ + 724 (NSThread.m:991)
11  libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
12  libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 2:
0   libsystem_kernel.dylib        	0x00000001e9e4a688 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001e9e4dd98 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001e9e4dcb0 mach_msg_overwrite + 424 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001e9e4dafc mach_msg + 24 (mach_msg.c:323)
4   Casino                        	0x0000000103d4d11c exception_server_thread + 188 (PLCrashMachExceptionServer.m:681)
5   libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
6   libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 3:
0   libsystem_kernel.dylib        	0x00000001e9e4ff90 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000221fbea50 _pthread_cond_wait + 1204 (pthread_cond.c:862)
2   JavaScriptCore                	0x00000001b17fabe0 0x1b0254000 + 22703072
3   libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
4   libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 4:
0   libsystem_kernel.dylib        	0x00000001e9e4a688 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001e9e4dd98 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001e9e4dcb0 mach_msg_overwrite + 424 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001e9e4dafc mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x0000000199a89a84 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)
5   CoreFoundation                	0x0000000199a89130 __CFRunLoopRun + 1212 (CFRunLoop.c:3021)
6   CoreFoundation                	0x0000000199a88830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)
7   CFNetwork                     	0x000000019b004ee0 +[__CFN_CoreSchedulingSetRunnable _run:] + 416 (CoreSchedulingSet.mm:1473)
8   Foundation                    	0x00000001987416c8 __NSThread__start__ + 724 (NSThread.m:991)
9   libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
10  libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 5 Crashed:
0   CoreFoundation                	0x0000000199a78a44 _CFStringCreateByAddingPercentEncodingWithAllowedCharacters + 512 (CFURLComponents_URIParser.c:0)
1   Foundation                    	0x0000000198713298 -[NSString(NSURLUtilities) stringByAddingPercentEncodingWithAllowedCharacters:] + 32 (NSURL.m:1882)
2   Foundation                    	0x0000000198d08da4 closure swiftlang/swift#1 in StringProtocol.addingPercentEncoding(withAllowedCharacters:) + 92 (NSStringAPI.swift:854)
3   Foundation                    	0x0000000198d0aaf0 partial apply for closure swiftlang/swift#1 in StringProtocol.addingPercentEncoding(withAllowedCharacters:) + 24 (<compiler-generated>:0)
4   Foundation                    	0x0000000198d077d0 specialized CharacterSet.withUnsafeImmutableStorage<A>(_:) + 64 (CharacterSet.swift:0)
5   Foundation                    	0x0000000198713268 StringProtocol.addingPercentEncoding(withAllowedCharacters:) + 68 (NSStringAPI.swift:853)
6   Casino                        	0x000000010326b86c static Utilities.urlEncode(_:) + 56 (Utilities.swift:137)
7   Casino                        	0x000000010326b86c specialized closure swiftlang/swift#1 in static Utilities.urlEncode(_:) + 368 (Utilities.swift:128)
8   Casino                        	0x00000001032c9434 specialized thunk for @callee_guaranteed (@guaranteed String, @in_guaranteed Any) -> (@owned String, @error @owned Error) + 12 (<compiler-generated>:0)
9   Casino                        	0x00000001032c9434 specialized Collection.map<A>(_:) + 360
10  Casino                        	0x00000001032cc6a0 static Utilities.urlEncode(_:) + 12 (Utilities.swift:127)
11  Casino                        	0x00000001032cc6a0 DefaultNetworkConnection.buildGet(_:) + 504 (DefaultNetworkConnection.swift:246)
12  Casino                        	0x00000001032cce30 closure swiftlang/swift#1 in DefaultNetworkConnection.sendRequests(_:) + 44 (DefaultNetworkConnection.swift:121)
13  Casino                        	0x00000001032cce30 specialized Collection.map<A>(_:) + 276 (<compiler-generated>:0)
14  Casino                        	0x00000001032caa8c specialized Collection.map<A>(_:) + 16 (<compiler-generated>:0)
15  Casino                        	0x00000001032caa8c DefaultNetworkConnection.sendRequests(_:) + 240 (DefaultNetworkConnection.swift:121)
16  Casino                        	0x00000001032cb194 @objc DefaultNetworkConnection.sendRequests(_:) + 68 (<compiler-generated>:0)
17  Casino                        	0x0000000103222a88 closure swiftlang/swift#2 in Emitter.attemptEmit() + 76 (Emitter.swift:380)
18  Casino                        	0x00000001032c92bc thunk for @escaping @callee_guaranteed @Sendable () -> () + 28 (<compiler-generated>:0)
19  libdispatch.dylib             	0x00000001a178c370 _dispatch_call_block_and_release + 32 (init.c:1549)
20  libdispatch.dylib             	0x00000001a178e0d0 _dispatch_client_callout + 20 (object.m:576)
21  libdispatch.dylib             	0x00000001a17956d8 _dispatch_lane_serial_drain + 744 (queue.c:3934)
22  libdispatch.dylib             	0x00000001a17961e0 _dispatch_lane_invoke + 380 (queue.c:4025)
23  libdispatch.dylib             	0x00000001a17a1258 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:7193)
24  libdispatch.dylib             	0x00000001a17a0aa4 _dispatch_workloop_worker_thread + 540 (queue.c:6787)
25  libsystem_pthread.dylib       	0x0000000221fbfc7c _pthread_wqthread + 288 (pthread.c:2696)
26  libsystem_pthread.dylib       	0x0000000221fbc488 start_wqthread + 8 (:-1)

Thread 6:
0   libsystem_pthread.dylib       	0x0000000221fbc480 start_wqthread + 0 (:-1)

Thread 7:
0   libsystem_pthread.dylib       	0x0000000221fbc480 start_wqthread + 0 (:-1)

Thread 8:
0   libsystem_pthread.dylib       	0x0000000221fbc480 start_wqthread + 0 (:-1)

Thread 9:
0   libsystem_pthread.dylib       	0x0000000221fbc480 start_wqthread + 0 (:-1)

Thread 10:
0   libsystem_pthread.dylib       	0x0000000221fbc480 start_wqthread + 0 (:-1)

Thread 11:
0   libsystem_kernel.dylib        	0x00000001e9e4a61c semaphore_timedwait_trap + 8 (:-1)
1   libdispatch.dylib             	0x00000001a178e6e8 _dispatch_sema4_timedwait + 64 (lock.c:154)
2   libdispatch.dylib             	0x00000001a178ece8 _dispatch_semaphore_wait_slow + 76 (semaphore.c:116)
3   libdispatch.dylib             	0x00000001a179fb60 _dispatch_worker_thread + 324 (queue.c:7509)
4   libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
5   libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 12:
0   libsystem_kernel.dylib        	0x00000001e9e4a61c semaphore_timedwait_trap + 8 (:-1)
1   libdispatch.dylib             	0x00000001a178e6e8 _dispatch_sema4_timedwait + 64 (lock.c:154)
2   libdispatch.dylib             	0x00000001a178ece8 _dispatch_semaphore_wait_slow + 76 (semaphore.c:116)
3   libdispatch.dylib             	0x00000001a179fb60 _dispatch_worker_thread + 324 (queue.c:7509)
4   libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
5   libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 13:
0   libsystem_kernel.dylib        	0x00000001e9e4a688 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001e9e4dd98 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001e9e4dcb0 mach_msg_overwrite + 424 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001e9e4dafc mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x0000000199a89a84 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)
5   CoreFoundation                	0x0000000199a89130 __CFRunLoopRun + 1212 (CFRunLoop.c:3021)
6   CoreFoundation                	0x0000000199a88830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)
7   Foundation                    	0x0000000198730500 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                    	0x00000001987303d4 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:398)
9   SwiftUI                       	0x000000019e9e51f4 specialized static DisplayLink.asyncThread(arg:) + 792 (UIHostingViewBase.swift:1382)
10  SwiftUI                       	0x000000019e9e4558 @objc static DisplayLink.asyncThread(arg:) + 72 (<compiler-generated>:1364)
11  Foundation                    	0x00000001987416c8 __NSThread__start__ + 724 (NSThread.m:991)
12  libsystem_pthread.dylib       	0x0000000221fc137c _pthread_start + 136 (pthread.c:931)
13  libsystem_pthread.dylib       	0x0000000221fbc494 thread_start + 8 (:-1)

Thread 14:
0   libsystem_malloc.dylib        	0x00000001a9ce26c0 _nanov2_free + 660 (nanov2_malloc.c:1198)
1   libswiftCore.dylib            	0x000000019843883c _swift_release_dealloc + 56 (HeapObject.cpp:847)
2   libswiftCore.dylib            	0x0000000198439950 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 160 (RefCount.h:0)
3   CoreFoundation                	0x0000000199a41f18 __CFBasicHashDrain + 404 (CFBasicHash.c:1150)
4   CoreFoundation                	0x0000000199a3d30c _CFRelease + 292 (CFRuntime.c:2169)
5   Foundation                    	0x00000001986a1dac _NSXPCSerializationCreateWriteData + 60 (NSXPCCoder_Serialization.m:272)
6   Foundation                    	0x00000001986a1cb4 -[NSXPCEncoder _encodeInvocationObjectArgumentsOnly:count:typeString:selector:isReply:into:] + 236 (NSXPCCoder.m:532)
7   Foundation                    	0x00000001986d675c -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 1208 (NSXPCConnection.m:1522)
8   Foundation                    	0x000000019873d0c4 -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:arg3:arg4:] + 144 (NSXPCConnection.m:1315)
9   Foundation                    	0x000000019873cfdc _NSXPCDistantObjectSimpleMessageSend4 + 84 (NSXPCDistantObject.m:292)
10  CoreTelephony                 	0x000000019b2d4d70 -[CoreTelephonyClient(CarrierBundle) copyCarrierBundleValue:key:bundleType:error:] + 392 (CoreTelephonyClient+CarrierBundle.mm:72)
11  CoreTelephony                 	0x000000019b2d4054 -[CTTelephonyNetworkInfo getCarrierName:forContext:withError:] + 120 (CTTelephonyNetworkInfo.mm:315)
12  CoreTelephony                 	0x000000019b2d33e4 -[CTTelephonyNetworkInfo updateNetworkInfoAndShouldNotifyClient:forContext:] + 164 (CTTelephonyNetworkInfo.mm:452)
13  CoreTelephony                 	0x000000019b2d2d68 -[CTTelephonyNetworkInfo initWithClient:] + 528 (CTTelephonyNetworkInfo.mm:236)
14  CoreTelephony                 	0x000000019b2cbfe4 -[CTTelephonyNetworkInfo init] + 96 (CTTelephonyNetworkInfo.mm:205)
15  Casino                        	0x00000001030a3c48 @nonobjc CTTelephonyNetworkInfo.init() + 12 (<compiler-generated>:0)
16  Casino                        	0x00000001030a3c48 CTTelephonyNetworkInfo.__allocating_init() + 24 (CTTelephonyNetworkInfo.swift:10)
17  Casino                        	0x00000001030a3c48 CTTelephonyNetworkInfo.carrierTypeName.getter + 24 (<compiler-generated>:0)
18  Casino                        	0x00000001030a3c48 protocol witness for CTTelephonyNetworkInfoProtocol.carrierTypeName.getter in conformance CTTelephonyNetworkInfo + 40
19  Casino                        	0x00000001030d4798 ReachabilityProviding.connectionType.getter + 336 (ReachabilityProviding.swift:38)
20  Casino                        	0x00000001030e1b20 SplunkReportRequestBuilder.makeClientMetadata(context:) + 12 (SplunkReportRequestBuilder.swift:62)
21  Casino                        	0x00000001030e1b20 SplunkReportRequestBuilder.makeEventRequest(events:) + 360 (SplunkReportRequestBuilder.swift:19)
22  Casino                        	0x00000001030f4774 SplunkManager.submitEvents(customerId:username:events:completionHandler:) + 392 (SplunkManager.swift:16)
23  Casino                        	0x00000001030ed2f0 closure swiftlang/swift#1 in Splunk.submit(customerId:username:events:completionHandler:) + 280 (Splunk.swift:132)
24  Casino                        	0x00000001030ecf94 thunk for @escaping @callee_guaranteed @Sendable () -> () + 28
25  libdispatch.dylib             	0x00000001a178c370 _dispatch_call_block_and_release + 32 (init.c:1549)
26  libdispatch.dylib             	0x00000001a178e0d0 _dispatch_client_callout + 20 (object.m:576)
27  libdispatch.dylib             	0x00000001a17956d8 _dispatch_lane_serial_drain + 744 (queue.c:3934)
28  libdispatch.dylib             	0x00000001a17961e0 _dispatch_lane_invoke + 380 (queue.c:4025)
29  libdispatch.dylib             	0x00000001a17a1258 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:7193)
30  libdispatch.dylib             	0x00000001a17a0aa4 _dispatch_workloop_worker_thread + 540 (queue.c:6787)
31  libsystem_pthread.dylib       	0x0000000221fbfc7c _pthread_wqthread + 288 (pthread.c:2696)
32  libsystem_pthread.dylib       	0x0000000221fbc488 start_wqthread + 8 (:-1)

Thread 15:
0   libsystem_pthread.dylib       	0x0000000221fbc480 start_wqthread + 0 (:-1)

Thread 5 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000bec   x1: 0x00000001595a5c00   x2: 0x0000000000000bec   x3: 0x0000000008000100
    x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x00000000000023c4
    x8: 0x0000000000000bec   x9: 0x0000000302f45110  x10: 0x0000000000000005  x11: 0x0000000000000000
   x12: 0x0000000105cebff8  x13: 0x0000000000000000  x14: 0x01000001fd86c3c1  x15: 0x00000001fd86c3c0
   x16: 0x0000000000000007  x17: 0x0000000199a3bed8  x18: 0x0000000000000000  x19: 0x0000000000008f10
   x20: 0x0000000000000000  x21: 0x00000000000023c4  x22: 0x0000000302c50f60  x23: 0x0000000000000000
   x24: 0x00000000000023c4  x25: 0x0000000000000025  x26: 0x0000000199ec855a  x27: 0x00000001fef4f578
   x28: 0x0000000104225710   fp: 0x00000003d5f6a100   lr: 0xf84b000199a789d4
    sp: 0x00000003d5f6a090   pc: 0x0000000199a78a44 cpsr: 0x20001000
   esr: 0x92000006 (Data Abort) byte read Translation fault


Binary Images:
        0x102fec000 -         0x104577fff Casino arm64  <c235ffcec1243a86a06e75d78e996bbb> /private/var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Casino
        0x104bc0000 -         0x104bfbfff FBAEMKit arm64  <ac9592c9aa6735fb9e239f3ede984913> /private/var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Frameworks/FBAEMKit.framework/FBAEMKit
        0x104dc8000 -         0x104f8bfff Lottie arm64  <4c5219a480bf3b5fa4f4c38d50491047> /private/var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Frameworks/Lottie.framework/Lottie
        0x105038000 -         0x105167fff FBSDKCoreKit arm64  <7e56c1979bc63bc097b8e87abaabd89c> /private/var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit
        0x105378000 -         0x105387fff FBSDKCoreKit_Basics arm64  <6ed9543dd0003c65a476da0b5450fce2> /private/var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Frameworks/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics
        0x1053a0000 -         0x10543bfff OPPWAMobile arm64  <c0a3d3996a043424b4a161a2919abcb5> /private/var/containers/Bundle/Application/17C03FC7-A322-4858-BE96-74E37D52D66C/Casino.app/Frameworks/OPPWAMobile.framework/OPPWAMobile
        0x107df8000 -         0x107e03fff libobjc-trampolines.dylib arm64e  <35a44678195b39c2bdd7072893564b45> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x130fd8000 -         0x130fdbfff iCloudDriveFileProviderOverride arm64e  <5de9ce32cd703abca0b951643ad20971> /System/Library/Frameworks/FileProvider.framework/OverrideBundles/iCloudDriveFileProviderOverride.bundle/iCloudDriveFileProviderOverride
        0x131004000 -         0x13100bfff FileProviderOverride arm64e  <664c9c68fd2032c39751b24182c710a7> /System/Library/Frameworks/FileProvider.framework/OverrideBundles/FileProviderOverride.bundle/FileProviderOverride
        0x198061000 -         0x198602fff libswiftCore.dylib arm64e  <1ae81ac9024c33c59e78ccfa639c5f06> /usr/lib/swift/libswiftCore.dylib
        0x198679000 -         0x199386fff Foundation arm64e  <6d0212cc3b9e32c9be2072989ce3acb8> /System/Library/Frameworks/Foundation.framework/Foundation
        0x199a36000 -         0x199f78fff CoreFoundation arm64e  <1532d3d89b3b3f2fb35f55a20ddf411b> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x19af07000 -         0x19b2c9fff CFNetwork arm64e  <999c659afc7d351fa477e97bbf2d8081> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
        0x19b2ca000 -         0x19b4e6fff CoreTelephony arm64e  <57537ae194b5360ab85a2c416b65f22f> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
        0x19c21c000 -         0x19e0effff UIKitCore arm64e  <575e5140fa6a37c2b00ba4eacedfda53> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x19e0f0000 -         0x19f3e4fff SwiftUI arm64e  <9f67c19cfcde3e979fc23bba36998297> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
        0x1a178a000 -         0x1a17cffff libdispatch.dylib arm64e  <7de7ec03cfb7349d9b9e8782b38f231d> /usr/lib/system/libdispatch.dylib
        0x1a17d0000 -         0x1a184fff3 libsystem_c.dylib arm64e  <0150f750db0a3f54b23ad21c55af8824> /usr/lib/system/libsystem_c.dylib
        0x1a9cdf000 -         0x1a9d1aff7 libsystem_malloc.dylib arm64e  <5dba2c0192ca3d1da27eb4e14cffb2f0> /usr/lib/system/libsystem_malloc.dylib
        0x1b0254000 -         0x1b19d8fff JavaScriptCore arm64e  <c3d567d87bc136f1a811d8b12a954c96> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
        0x1bf443000 -         0x1bf4c699f dyld arm64e  <3060d36a16ce3c3a92583881459f5714> /usr/lib/dyld
        0x1c5d07000 -         0x1c5d4afff AttributeGraph arm64e  <6dfbf865450c3897a13fc9a348db0267> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
        0x1e5a67000 -         0x1e5a6ffff GraphicsServices arm64e  <8425ea11000e3e5e8abcbddf3ff3fa32> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
        0x1e9e49000 -         0x1e9e82ff3 libsystem_kernel.dylib arm64e  <b9618c71c0cb31b6825f92a4737c890e> /usr/lib/system/libsystem_kernel.dylib
        0x221fbb000 -         0x221fc7ff3 libsystem_pthread.dylib arm64e  <3ca98e388eee3c269862c5f66aad93c0> /usr/lib/system/libsystem_pthread.dylib
        0x25966e000 -         0x25a1fcfff SwiftUICore arm64e  <e693f599f25631b2a6efc4c1334972b7> /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore

EOF

Expected behavior

Nil return

Environment

All crash reports show iOS 18.1.1

Additional information

No response

@compnerd
Copy link
Member

Moving this to swift-corelibs-foundation, but note that swift-corelibs-foundation is not under active development. From the stack trace, this seems like it might be better suited as a Feedback report, but I'll leave that to @jmschonfeld and @parkera to sort out.

@compnerd compnerd transferred this issue from swiftlang/swift Jan 21, 2025
@parkera
Copy link
Contributor

parkera commented Jan 21, 2025

Is there some particular input which causes this? Does it always reproduce, or just sometimes?

@MaxMacleod
Copy link

MaxMacleod commented Jan 23, 2025

Hello!
that's a great question. We think this occurs for a subset of users. Exclusively on 18.1.1. The last crash report occurred 16th January.

Unfortunately we don't have the input.

Now, here's the thing. Within the addingPercentEncoding method, there is a FIX comment. The comment states that there is a defect whereby failure to transform should return nil. We suspect that because of this defect, memory is mishandled. So, rather than return nil, a SEGV_MAPERR occurs.

We could spend more time on this. However, users are upgrading from 18.1.1. Our plan is to keep under observation. If we see reports on 18.2.x or higher, we will investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants