OIDURLQueryComponent crashes when parameter doesn't have a value/is nil
Nobody has claimed this yet.
- Dominant language
- Objective-C
- Stars
- 2k
- Forks
- 867
- Avg merge
- 4d 48m
- Merged PRs (30d)
- 1
Description
Describe the bug
When the redirect url contains an empty parameter the app crashes.
To Reproduce
The redirect url should contain an empty parameters.
Probably ?paramter1=
I haven't been able to reproduce it myself as the server doesn't always give me a bad url.
Expected behavior
Do not crash. Ignore the parameter.
Additional context
The crash log
See:
2 CoreFoundation 0x1b986ded -[__NSArrayM insertObject:atIndex:]
log.txt
# Platform: ios # Date: 2019-09-28T16:34:00Z # OS Version: 10.3.4 (14G61) # Device: iPad 4 # RAM Free: 3.8% # Disk Free: 28.6%#0. Crashed: com.twitter.crashlytics.ios.exception
0 0x554c09 CLSProcessRecordAllThreads + 5970953
1 0x554c09 CLSProcessRecordAllThreads + 5970953
2 0x554e99 CLSProcessRecordAllThreads + 5971609
3 0x5485e9 CLSHandler + 5920233
4 0x5538af __CLSExceptionRecord_block_invoke + 5965999
5 libdispatch.dylib 0x1b141783 _dispatch_client_callout + 22
6 libdispatch.dylib 0x1b14da35 _dispatch_barrier_sync_f_invoke + 50
7 0x5532af CLSExceptionRecord + 5964463
8 0x5530d7 CLSExceptionRecordNSException + 5963991
9 0x552c8d CLSTerminateHandler() + 5962893
10 libc++abi.dylib 0x1acef98f std::__terminate(void (*)()) + 78
11 libc++abi.dylib 0x1acef493 __cxa_rethrow + 90
12 libobjc.A.dylib 0x1acfb1ab objc_exception_rethrow + 42
13 CoreFoundation 0x1b981231 CFRunLoopRunSpecific + 600
14 CoreFoundation 0x1b980fd1 CFRunLoopRunInMode + 104
15 GraphicsServices 0x1d12bb41 GSEventRunModal + 80
16 UIKit 0x20d03a53 UIApplicationMain + 150
17 0x86219 main + 23 (AppDelegate.swift:23)
18 libdyld.dylib 0x1b16e4eb + 2--
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x1ba73b3d __exceptionPreprocess
1 libobjc.A.dylib 0x1acfb067 objc_exception_throw
2 CoreFoundation 0x1b986ded -[__NSArrayM insertObject:atIndex:]
3 AppAuth 0x121bf09 -[OIDURLQueryComponent addParameter:value:] + 103 (OIDURLQueryComponent.m:103)
4 AppAuth 0x121bbe1 -[OIDURLQueryComponent initWithURL:] + 49 (OIDURLQueryComponent.m:49)
5 AppAuth 0x1211f19 -[OIDAuthorizationFlowSessionImplementation resumeAuthorizationFlowWithURL:] + 115 (OIDAuthorizationService.m:115)
6 0x506b1d specialized AppDelegate.application(:open:sourceApplication:annotation:) + 147 (AppDelegate.swift:147)
7 0x506075 @objc AppDelegate.application(:open:sourceApplication:annotation:) ()
8 UIKit 0x20f1d3bf __45-[UIApplication _applicationOpenURL:payload:]_block_invoke
9 UIKit 0x20f1ce0d -[UIApplication applicationOpenURL:payload:]
10 SafariServices 0x289c0d6b -[SFSafariViewController remoteViewController:hostApplicationOpenURL:]
11 SafariServices 0x289b84e9 -[SFBrowserRemoteViewController willOpenURLInHostApplication:]
12 CoreFoundation 0x1ba78354 invoking
13 CoreFoundation 0x1b99c2b9 -[NSInvocation invoke]
14 FrontBoardServices 0x1d354c13 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
15 FrontBoardServices 0x1d354acd -[FBSSerialQueue _performNext]
16 FrontBoardServices 0x1d354db7 -[FBSSerialQueue _performNextFromRunLoopSource]
17 CoreFoundation 0x1ba2ffdd CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
18 CoreFoundation 0x1ba2fb05 __CFRunLoopDoSources0
19 CoreFoundation 0x1ba2df51 __CFRunLoopRun
20 CoreFoundation 0x1b9811af CFRunLoopRunSpecific
21 CoreFoundation 0x1b980fd1 CFRunLoopRunInMode
22 GraphicsServices 0x1d12bb41 GSEventRunModal
23 UIKit 0x20d03a53 UIApplicationMain
24 0x86219 main + 23 (AppDelegate.swift:23)
25 libdyld.dylib 0x1b16e4eb (Missing)#0. Crashed: com.twitter.crashlytics.ios.exception
0 0x554c09 CLSProcessRecordAllThreads + 5970953
1 0x554c09 CLSProcessRecordAllThreads + 5970953
2 0x554e99 CLSProcessRecordAllThreads + 5971609
3 0x5485e9 CLSHandler + 5920233
4 0x5538af __CLSExceptionRecord_block_invoke + 5965999
5 libdispatch.dylib 0x1b141783 _dispatch_client_callout + 22
6 libdispatch.dylib 0x1b14da35 _dispatch_barrier_sync_f_invoke + 50
7 0x5532af CLSExceptionRecord + 5964463
8 0x5530d7 CLSExceptionRecordNSException + 5963991
9 0x552c8d CLSTerminateHandler() + 5962893
10 libc++abi.dylib 0x1acef98f std::__terminate(void (*)()) + 78
11 libc++abi.dylib 0x1acef493 __cxa_rethrow + 90
12 libobjc.A.dylib 0x1acfb1ab objc_exception_rethrow + 42
13 CoreFoundation 0x1b981231 CFRunLoopRunSpecific + 600
14 CoreFoundation 0x1b980fd1 CFRunLoopRunInMode + 104
15 GraphicsServices 0x1d12bb41 GSEventRunModal + 80
16 UIKit 0x20d03a53 UIApplicationMain + 150
17 0x86219 main + 23 (AppDelegate.swift:23)
18 libdyld.dylib 0x1b16e4eb + 2#1. com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1b22c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b22c6e1 mach_msg + 44
2 CoreFoundation 0x1ba2fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1ba2e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b9811af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b980fd1 CFRunLoopRunInMode + 104
6 Foundation 0x1c2d5af5 + 258
7 Foundation 0x1c2f276d + 86
8 UIKit 0x21604ad9 -[UIEventFetcher threadMain] + 128
9 Foundation 0x1c3b98eb + 1122
10 libsystem_pthread.dylib 0x1b2f893b _pthread_body + 216
11 libsystem_pthread.dylib 0x1b2f885d _pthread_start + 234
12 libsystem_pthread.dylib 0x1b2f6468 thread_start + 8#2. AVAudioSession Notify Thread
0 libsystem_kernel.dylib 0x1b22c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b22c6e1 mach_msg + 44
2 CoreFoundation 0x1ba2fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1ba2e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b9811af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b980fd1 CFRunLoopRunInMode + 104
6 AVFAudio 0x3200b82f GenericRunLoopThread::Entry(void*) + 142
7 AVFAudio 0x3203458f CAPThread::Entry(CAPThread*) + 154
8 libsystem_pthread.dylib 0x1b2f893b _pthread_body + 216
9 libsystem_pthread.dylib 0x1b2f885d _pthread_start + 234
10 libsystem_pthread.dylib 0x1b2f6468 thread_start + 8#3. com.twitter.crashlytics.ios.MachExceptionServer
0 libsystem_kernel.dylib 0x1b22c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b22c6e1 mach_msg + 44
2 0x544103 CLSMachExceptionServer + 5902595
3 libsystem_pthread.dylib 0x1b2f893b _pthread_body + 216
4 libsystem_pthread.dylib 0x1b2f885d _pthread_start + 234
5 libsystem_pthread.dylib 0x1b2f6468 thread_start + 8#4. com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1b22c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1b22c6e1 mach_msg + 44
2 CoreFoundation 0x1ba2fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1ba2e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b9811af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b980fd1 CFRunLoopRunInMode + 104
6 CFNetwork 0x1c05e393 +[NSURLConnection(Loader) _resourceLoadLoop:] + 402
7 Foundation 0x1c3b98eb + 1122
8 libsystem_pthread.dylib 0x1b2f893b _pthread_body + 216
9 libsystem_pthread.dylib 0x1b2f885d _pthread_start + 234
10 libsystem_pthread.dylib 0x1b2f6468 thread_start + 8#5. Thread
0 libsystem_kernel.dylib 0x1b241808 __psynch_cvwait + 24
1 libsystem_pthread.dylib 0x1b2f7c43 _pthread_cond_wait + 560
2 libsystem_pthread.dylib 0x1b2f8fc5 pthread_cond_wait + 38
3 libc++.1.dylib 0x1ac93c57 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 118
4 JavaScriptCore 0x1f8e8261 + 88
5 JavaScriptCore 0x1f8e81e5 + 154
6 JavaScriptCore 0x1f8e80ed + 18
7 JavaScriptCore 0x1f8e832f + 66
8 libsystem_pthread.dylib 0x1b2f893b _pthread_body + 216
9 libsystem_pthread.dylib 0x1b2f885d _pthread_start + 234
10 libsystem_pthread.dylib 0x1b2f6468 thread_start + 8#6. Thread
0 libsystem_kernel.dylib 0x1b24273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b2f68eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1b2f645c start_wqthread + 8#7. Thread
0 libsystem_kernel.dylib 0x1b24273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b2f6745 _pthread_wqthread + 728
2 libsystem_pthread.dylib 0x1b2f645c start_wqthread + 8#8. Thread
0 libsystem_kernel.dylib 0x1b24273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b2f6745 _pthread_wqthread + 728
2 libsystem_pthread.dylib 0x1b2f645c start_wqthread + 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in OIDURLQueryComponent.m, especially initWithURL: at line 49 and addParameter:value: at line 103, which the crash log identifies. Trace how an empty redirect-URL parameter reaches the mutable array, then verify that a missing or empty value is ignored without crashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100