Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
What is Kernel protection error?
Where can i find the details about Exception type and code clearly?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can see the full list of Mach kernel exceptions in /usr/include/mach/exception_types.h. Most if not all boil down to some flavor of “your program did something wrong”.
As hotpaw2 already told you, the specific thing you did wrong in this case was dereference
NULL. You might have done this directly, in your own code, or indirectly by passingNULLto some library function or framework method. For example, passingNULLas one of the pointer arguments tomemcpyis a good way to cause this crash.Note that sending an Objective-C message to
nilis OK—it does nothing and returns 0. On the other hand, passingnilas an argument in a message may not be OK. Passingnilwhere it isn’t wanted may result in an NSException being thrown (which will cause aSIGTRAP, notSIGBUS, signal), or it may lead to some code eventually dereferencingNULL. Or it may be perfectly harmless. But you shouldn’t do it unless the documentation explicitly says it’s OK, because otherwise, even if it works now, it may break later.