DataDome / IOSSDK-Example

MIT License
2 stars 0 forks source link

SDK v1.114.8 produces a crash when calling ".withDataDome(dataDome)" #4

Open eMdOS opened 4 years ago

eMdOS commented 4 years ago

According to the function signature, it can receive a nil:

public func withDataDome(_ sdk: DataDomeSDK.DataDomeSDK?) -> Self

...but, when passing a nil it produces the following crash:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_TtGCs23_ContiguousArrayStorageCSo23NSURLSessionTaskMetrics_$ allHeaderFields]: unrecognized selector sent to instance 0x7b0c000e6b20'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010bc9eb0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010b70a141 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010bd0e134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x000000010bc25840 ___forwarding___ + 1024
    4   CoreFoundation                      0x000000010bc253b8 _CF_forwarding_prep_0 + 120
    5   DataDomeSDK                         0x000000010680a97e $s9Alamofire11DataRequestC0B7DomeSDKE04withbD0yACXDA2DCSgFyAA0B8ResponseVy10Foundation0B0VSgAA7AFErrorOGcfU_ + 478
    6   Alamofire                           0x0000000104eaaa6c $s9Alamofire11DataRequestC8response5queue17completionHandlerACXDSo012OS_dispatch_E0C_yAA0B8ResponseVy10Foundation0B0VSgAA7AFErrorOGctFyycfU_yycfU_yycfU_yycfU_ + 156
    7   Alamofire                           0x0000000104ecc8ba $s9Alamofire11DataRequestC8response5queue17completionHandlerACXDSo012OS_dispatch_E0C_yAA0B8ResponseVy10Foundation0B0VSgAA7AFErrorOGctFyycfU_yycfU_yycfU_yycfU_TA + 42
    8   Alamofire                           0x0000000104dd3794 $sIeg_IeyB_TR + 100
    9   libclang_rt.tsan_iossim_dynamic.dylib 0x0000000103f2b53c _ZN6__tsanL24invoke_and_release_blockEPv + 12
    10  libclang_rt.tsan_iossim_dynamic.dylib 0x0000000103f2b292 _ZN6__tsanL22dispatch_callback_wrapEPv + 306
    11  libdispatch.dylib                   0x000000010cbd705c _dispatch_client_callout + 8
    12  libdispatch.dylib                   0x000000010cbb840b _dispatch_main_queue_callback_4CF + 411
    13  CoreFoundation                      0x000000010bc63909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    14  CoreFoundation                      0x000000010bc29ae4 __CFRunLoopRun + 2164
    15  CoreFoundation                      0x000000010bc29016 CFRunLoopRunSpecific + 406
    16  GraphicsServices                    0x000000010eec3a24 GSEventRunModal + 62
    17  UIKit                               0x0000000107f13134 UIApplicationMain + 159
    18  MyApp                               0x0000000102c44613 main + 195
    19  libdyld.dylib                       0x000000010cc2365d start + 1
    20  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Info

Podfile (same as the sample app):

pod 'DataDomeSDK', '~> 1.114.0'
pod 'Alamofire', '~> 5.0.0'

iOS Version: 10 Xcode: 11.5 (11E608c)

meddatadome commented 4 years ago

Thanks @eMdOS for reporting this issue. Would you please provide the version of the SDK you are using? Thanks

meddatadome commented 4 years ago

I was able to reproduce the crash. It is not related to the SDK. You can pass nil to the method public func withDataDome(_ sdk: DataDomeSDK.DataDomeSDK?) -> Self As the sdk parameter is optional and the request will succeed. I have committed some changes to the app to avoid the crash. Make sure to git pull and pod install

Thanks

eMdOS commented 4 years ago

In real projects, the issues persist, it produces an EXC_BADACCESS in `DataDomeSDKHandler.retry(:for:dueTo:completion:)when passingniltowithDataDome(_:)`:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_TtGCs23_ContiguousArrayStorageCSo23NSURLSessionTaskMetrics_$ allHeaderFields]: unrecognized selector sent
meddatadome commented 4 years ago

Thanks @eMdOS for reporting this. Would you please provide the configuration your are using:

Thanks