Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Crash in fleece::Scope [CBSE-6472] #712
In CBSE-6472, an iOS app is crashing when fleece::Scope throws an exception on a bg thread while updating a live query. This is in a recent custom build 2.5.0-SB3.
This exception happens when two conflicting Scopes are registered on the same region of memory. It happens when a Scope outlives the heap block containing its data — what can happen then is that memory gets allocated for another heap block, and then a new Scope is registered for that block.
I had the idea of having Scope's destructor check whether the contents of the memory range have changed since it was constructed. Since Fleece docs are immutable, this should never happen. But if the heap block was freed, it will be altered immediately (at least in a debug build, thanks to MallocScribble.)
This exposed a bug in some of the internal query code, which I've fixed.