Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

ABKTriggerPropertyFilter.m line 138 - SDK 3.22.0 #243

Closed guidogoni closed 4 years ago

guidogoni commented 4 years ago

Fatal Exception: NSInternalInconsistencyException Can't do regex matching, reason: Can't open pattern U_REGEX_MISMATCHED_PAREN -[ABKTriggerPropertyFilter matchValue:]

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x1b7e1d794 __exceptionPreprocess
1  libobjc.A.dylib                0x1b7b3fbcc objc_exception_throw
2  Foundation                     0x1b813d578 +[_NSPredicateOperatorUtilities doRegexForString:pattern:likeProtect:flags:context:]
3  Foundation                     0x1b813cedc -[NSMatchingPredicateOperator performPrimitiveOperationUsingObject:andObject:]
4  Foundation                     0x1b810438c -[NSComparisonPredicate evaluateWithObject:substitutionVariables:]
5  Appboy_iOS_SDK                 0x101f1c2a8 -[ABKTriggerPropertyFilter matchValue:] + 138 (ABKTriggerPropertyFilter.m:138)
6  Appboy_iOS_SDK                 0x101f1baf8 -[ABKTriggerPropertyFilter matchProperties:] + 62 (ABKTriggerPropertyFilter.m:62)
7  Appboy_iOS_SDK                 0x101f95658 __38-[ABKPropertyTrigger matchProperties:]_block_invoke_2 + 49 (ABKPropertyTrigger.m:49)
8  CoreFoundation                 0x1b7df0e20 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
9  CoreFoundation                 0x1b7cf4d4c -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
10 Appboy_iOS_SDK                 0x101f95538 __38-[ABKPropertyTrigger matchProperties:]_block_invoke + 48 (ABKPropertyTrigger.m:48)
11 CoreFoundation                 0x1b7df0e20 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
12 CoreFoundation                 0x1b7cf4a48 -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:]
13 Appboy_iOS_SDK                 0x101f9537c -[ABKPropertyTrigger matchProperties:] + 45 (ABKPropertyTrigger.m:45)
14 Appboy_iOS_SDK                 0x101f6ab54 -[ABKCustomEventPropertyTrigger match:] + 21 (ABKCustomEventPropertyTrigger.m:21)
15 Appboy_iOS_SDK                 0x101f8010c -[ABKTriggeredAction respondsToTriggerEvent:] + 184 (ABKTriggeredAction.m:184)
16 Appboy_iOS_SDK                 0x101f4ee70 -[ABKTriggerManager topPriorityTriggerActionForEvent:] + 202 (ABKTriggerManager.m:202)
17 Appboy_iOS_SDK                 0x101f4ecc0 -[ABKTriggerManager triggerActionWithFallbacksForEvent:] + 192 (ABKTriggerManager.m:192)
18 Appboy_iOS_SDK                 0x101f5045c -[ABKTriggerManager processTriggerEvent:] + 353 (ABKTriggerManager.m:353)
19 Appboy_iOS_SDK                 0x101f5020c -[ABKTriggerManager processPendingTriggerEvents] + 338 (ABKTriggerManager.m:338)
20 Appboy_iOS_SDK                 0x101f4eb50 __51-[ABKTriggerManager handleTriggerFromNotification:]_block_invoke + 175 (ABKTriggerManager.m:175)
21 Foundation                     0x1b81e43f0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
22 Foundation                     0x1b80ef710 -[NSBlockOperation main]
23 Foundation                     0x1b81e664c __NSOPERATION_IS_INVOKING_MAIN__
24 Foundation                     0x1b80ef414 -[NSOperation start]
25 Foundation                     0x1b81e7044 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__
26 Foundation                     0x1b81e6b10 __NSOQSchedule_f
27 libdispatch.dylib              0x1b7a95c8c _dispatch_block_async_invoke2
28 libdispatch.dylib              0x1b7ae3524 _dispatch_client_callout
29 libdispatch.dylib              0x1b7a8be98 _dispatch_continuation_pop$VARIANT$mp
30 libdispatch.dylib              0x1b7a8b5ec _dispatch_async_redirect_invoke
31 libdispatch.dylib              0x1b7a98438 _dispatch_root_queue_drain
32 libdispatch.dylib              0x1b7a98bf8 _dispatch_worker_thread2
33 libsystem_pthread.dylib        0x1b7b34b38 _pthread_wqthread
34 libsystem_pthread.dylib        0x1b7b37740 start_wqthread
guidogoni commented 4 years ago

More info on this case, campaign had a load error from the marketing team, matches regex value was wrong (closing parenthesis before regex ended), this caused the app to explode as it was called on a view event.

My suggestion is for the web interface to advice on a wrong regex, not allowing it to apply. Although the SDK should verify the content of the regex so it won't explode using it directly in the app.

If you need any further information please ask.

Thanks!

tbelote commented 4 years ago

@guidogoni I believe this issue has been fixed in version 3.23.0 of the SDK. If you can try upgrading to the latest SDK it should no longer crash on invalid regular expressions. Please let me know if this does address your issue, if not I'll get started on a fix right away. We are also discussing regex validation in the web interface too.

guidogoni commented 4 years ago

Thanks @tbelote , effectively this has been fixed. Also, I have seen the new web popup when the regex is wrong. I'll close the ticket.

Screen Shot 2020-07-28 at 10 52 21