Details
-
Bug
-
Resolution: Fixed
-
Major
-
5.5.0
-
Untriaged
-
Unknown
Description
UBSan reports the following undefined behaviour when constructing a CouchKVStore object:
couch-kvstore.cc:305:20: runtime error: member access within address 0x000107b17000 which does not point to an object of type 'CouchKVStore'
|
0x000107b17000: note: object has invalid vptr
|
The issue is that we are passing a reference to a class member variable (fileRevMap) before it has been constructed.
The reason for the code to do this was to handle Read-Only and Read-Write CouchKVStore instances; which share a single revision map object between them - the r/w instance uses it's own (concrete) revisionMap member variable; whereas the r/o uses a reference to the
R/W's member.