I have an application that repeatedly tells a VNImageRequestHandler object to perform a VNDetectFaceRectanglesRequest from a CVPixelBuffer which is delivered to me from the iOS Camera.
I frequently see crashes from Fabric that look like this:
#0 Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
0  CoreVideo
CVPixelBufferGetWidth + 20
I already try and validate my CVPixelBuffer using an extension before I pass it to vision like this:
var isValid: Bool {
    let cvBufferWidth = CVPixelBufferGetWidth(self)
    let cvBufferHeight = CVPixelBufferGetHeight(self)
    let size = CVPixelBufferGetDataSize(self)
    let bytesPerRow = CVPixelBufferGetBytesPerRow(self)
    guard cvBufferWidth > 0 && cvBufferHeight > 0 && size > 0 && bytesPerRow > 0 else {
        return false
    }
    return true
}
I also only ever process one CVPixelBuffer at a time (Apple has a sample project that said this is best practice in the comments).
What should I do? I can't seem to shake this bug!! Should I lock the CVPixelBuffer's base address? 
CVPixelBufferLockBaseAddress(self, CVPixelBufferLockFlags.readOnly)
Apple says don't do this if using the GPU and I know vision will use the GPU in some cases.
Any ideas?