Strange crash

Good day!


I have a crash with such stacktrace top:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   ImageIO                         0x0000000184cf77f8 ERROR_ImageIO_DataIsNotReadable(unsigned char*) + 0
1   ImageIO                         0x0000000184cf7470 IIOImageSource::doBindToPlugin() + 240
2   ImageIO                         0x0000000184cf78d0 IIOImageSource::bindToPlugin() + 64
3   ImageIO                         0x0000000184cf7aec IIOImageSource::updatedCount() + 48
4   ImageIO                         0x0000000184cfb92c CGImageSourceGetCount + 112
5   UIKit                           0x0000000189204dd0 ImageRefAtPath + 320
6   UIKit                           0x000000018921763c _UIImageRefAtPath + 284
7   UIKit                           0x00000001894654b4 -[UIImage(UIImagePrivate) initWithContentsOfFile:cache:] + 116


I've tested my app in this place with all possible images I can have there - no problem. In what direction should I investigate further?


Some info for this crash (some fields ommitted intentionally)


Incident Identifier: 2AF1E795-50FE-4183-8979-2E79831F3899
CrashReporter Key:   6455c6ee59d3cc9576122259436a0c5d6c4badd7
Hardware Model:      iPhone9,3
Code Type:       ARM-64
Parent Process:  ? [1]


Date/Time:       2017-08-16 11:04:00.000 +0300
OS Version:      iOS 10.3.3 (14G60)
Report Version:  104


Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: 0x00000000 at 0x0000000106964000
Crashed Thread:  0


Thank you

Well, it looks like you were attempting to get an image from a file whose data was invalid, but I guess you know that already. The question is why the error didn't get returned to your code, where you could presumably deal with it.


I suggest you submit a bug report, attaching the crash log, with a description something like "UIImage creation crashes app instead of returning error", and see what comes back.

I'm having a similar issue with the same error. https://forums.developer.apple.com/thread/96014 Did you find out what caused the crash or how to deal with it?

Not quit the same, but I was recently getting a weird crash much like that in Simulator. Apparently a PNG file had gotten corrupted in the app bundle. I assume your crash is in the wild, and you can’t just do a clean rebuild (which worked for me).

Yes the crash is in the wild, and a corrupt PNG sounds plausible because users can upload user images and that image may be corrupted. The question is how can I either a) catch the exception or b) validate an image before accepting it as a user image

Strange crash
 
 
Q