Crash in -[AVCaptureDevice setTorchModeOnWithLevel:error:]
| Originator: | SlaunchaMan | ||
| Number: | rdar://14204574 | Date Originated: | 19-Jun-2013 01:23 PM |
| Status: | Insufficient information | Resolved: | |
| Product: | iPhone SDK | Product Version: | 6.1.4 |
| Classification: | Other Bug | Reproducible: | Unable |
Summary: We’re receiving crash reports from an app that uses AVCaptureDevice’s torch functionality as a flashlight. The code we call is as follows: [[self torchDevice] setTorchModeOnWithLevel:AVCaptureMaxAvailableTorchLevel error:error]; The problem is that in this case, error is NULL. I assume what’s happening is that the capture device encounters an error and tries to set the error parameter, but in dereferencing the NULL passed in, crashes. The crash is an EXC_BAD_ACCESS with the code “KERN_INVALID_ADDRESS at 0x0” which would support this hypothesis. Steps to Reproduce: 1. Create an app that calls -[AVCaptureDevice setTorchModeOnWithLevel:error:] 2. Pass NULL for the error parameter 3. Create a condition such that the call encounters an error. Expected Results: The call to -[AVCaptureDevice setTorchModeOnWithLevel:error:] will return NO. Actual Results: The call to -[AVCaptureDevice setTorchModeOnWithLevel:error:] crashes. Regression: -[AVCaptureDevice setTorchModeOnWithLevel:error:] is new in iOS 6. I’ve seen it on 6.0.x and 6.1.x builds. Notes: Other APIs that use error parameters work just fine when you pass NULL, which I use to signify that I don’t need an error returned to me. This could just be a case where the documentation is not clear.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!