The top 2 crashes of my application occur according to the following method:
+ (UIImage *)imageWithData:(NSData *)data scale:(CGFloat)scale
So far, this has occurred more than 2,000 times, and it appears somewhat differently according to the crash reports:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000004
Thread : Crashed: com.apple.main-thread
0 ImageIO 0x27b6a1b6 CGImagePlusSetImageBlockProc + 41
1 libsystem_malloc.dylib 0x34a5139b calloc + 58
2 ImageIO 0x27b671c5 initImagePng + 4492
3 ImageIO 0x27b65a2f makeImagePlus + 930
4 ImageIO 0x27b65271 CGImageSourceCreateImageAtIndex + 160
5 UIKit 0x2a1e0bf3 _UIImageRefFromData + 262
6 UIKit 0x2a32d191 -[UIImage(UIImagePrivate) _initWithData:preserveScale:cache:] + 76
7 UIKit 0x2a1e0ae5 -[UIImage initWithData:] + 28
8 UIKit 0x2a2a36af -[UIImage initWithData:scale:] + 22
9 UIKit 0x2a32b721 +[UIImage imageWithData:scale:] + 56
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000000
Thread : Crashed: com.apple.main-thread
0 CoreFoundation 0x25bca41c CFArrayGetCount + 23
1 ImageIO 0x26c3898b getImagePlus + 118
2 ImageIO 0x26c3898b getImagePlus + 118
3 ImageIO 0x26c38433 makeImagePlus + 46
4 ImageIO 0x26c37fed CGImageSourceCreateImageAtIndex + 160
5 UIKit 0x292954c3 _UIImageRefFromData + 282
6 UIKit 0x293e1ad9 -[UIImage(UIImagePrivate) _initWithData:preserveScale:cache:] + 76
7 UIKit 0x292953a5 -[UIImage initWithData:] + 28
8 UIKit 0x29357ee7 -[UIImage initWithData:scale:] + 22
9 UIKit 0x293e0081 +[UIImage imageWithData:scale:] + 56
EXC_BAD_ACCESS UNKNOWN at 0x0000000104f44000
Thread : Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x0000000194795390 _platform_memmove + 320
1 libsystem_c.dylib 0x0000000194690424 __memcpy_chk + 32
2 libsystem_c.dylib 0x0000000194690424 __memcpy_chk + 32
3 ImageIO 0x0000000184a3172c _CGImageSourceBindToPlugin + 316
4 ImageIO 0x0000000184a31574 CGImageSourceGetCount + 112
5 UIKit 0x000000018816d46c _UIImageRefFromData + 276
6 UIKit 0x00000001882d1c20 -[UIImage(UIImagePrivate) _initWithData:preserveScale:cache:] + 112
7 UIKit 0x000000018823e21c -[UIImage initWithData:scale:] + 32
8 UIKit 0x00000001882cffa4 +[UIImage imageWithData:scale:] + 72
I don’t see how my code can affect this, but I tried to send nil to this method and it just returns nil. Can damaged NSData really cause this crash? Does this method save NSData? What would be the reason if NSData would be released during processing of this string? I don’t think so because it is synchronous, right?
, , , . , 99% iOS 8.
.