Last active
August 9, 2020 16:44
-
-
Save dmaclach/b10b0a71ae614d304c067cb9bd264336 to your computer and use it in GitHub Desktop.
Compile this with Xcode 11 "release" and it will crash on ARMv7 due to misaligned read. Use a "single view" iOS App as your template, and replace AppDelegate.m with this code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@end | |
__attribute__((noinline)) double GPBCodedInputStreamReadDouble(uint8_t *buf) { | |
int64_t value = OSReadLittleInt64(buf, 0); | |
double result; | |
memcpy(&result, &value, sizeof(result)); | |
return result; | |
} | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Override point for customization after application launch. | |
double data[3] = {1, 2}; | |
uint8_t *bytes = ((uint8_t*)(data)) + 1; | |
double a = GPBCodedInputStreamReadDouble(bytes); | |
NSLog(@"%f", a); | |
return YES; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment