profile
viewpoint

Ask questionsUndefinedBehaviorSanitizer: undefined-behavior

Integration Method: Manual Xcode Version: Version 10.3 (10G8) Library Version: v3.4.5 Platform: iOS Language: Objective-C Description: When enabling the UndefinedBehaviorSanitizer i can see the following issue popping up

/Project/Mixpanel/MPTweakInline.m:21:60: runtime error: load of null pointer of type 'char *'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Project/Mixpanel/MPTweakInline.m:21:60 in 
(lldb) 

We use the MPTweakValue like this

MPTweakValue(@"subscriptionOffer", @"default")

Expected Behavior: I would expect either the encoding to be set, or the null pointer to be handled properly. With this setup i cannot run the UndefinedBehaviorSanitizer because mixpanel at the very start is already blocking it.

mixpanel/mixpanel-iphone

Answer questions mlostekk

Hi @zihejia

We have upgraded mixpanel to the latest version and the issue seems to be gone.

But for your information. The issue was happening when enablig the UndefinedBehaviorSanitizer inside

static MPTweak *_MPTweakCreateWithEntry(NSString *name, mp_tweak_entry *entry)
{
    NSString *encoding = [NSString stringWithFormat:@"%s", *entry->encoding];
    MPTweak *tweak = [[MPTweak alloc] initWithName:name andEncoding:encoding];
    ...

As the error describes above the entry->encoding was set to a null pointer. This was leading to the undefined behaviour

useful!

Related questions

Apple Rejection - TMS-90338: Non-public API usage (WKInterfaceDevice) hot 1
Github User Rank List