You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MB-29523: Avoid undefined behaviour upon zero-length SerialisedDocKey
As identified by UBSan, if we try to create a zero-length
SerialisedDocKey (which is valid); the current implementation passes a
null pointer to memcpy:
[ RUN ] MutationLogTest.Logging
runtime error: null pointer passed as argument 2, which is declared to never be null
#0 0x11e9309 in SerialisedDocKey::SerialisedDocKey(DocKey) kv_engine/engines/ep/src/storeddockey.h:277
#1 0x11e9309 in MutationLogEntryV2::MutationLogEntryV2(MutationLogType, unsigned short, DocKey const&) kv_engine/engines/ep/src/mutation_log_entry.h:310
#2 0x11e9309 in MutationLogEntryV2::MutationLogEntryV2(MutationLogType, unsigned short) kv_engine/engines/ep/src/mutation_log_entry.h:321
#3 0x11e9309 in MutationLogEntryV2::newEntry(unsigned char*, MutationLogType, unsigned short) kv_engine/engines/ep/src/mutation_log_entry.h:223
#4 0x11e9309 in MutationLog::commit1() kv_engine/engines/ep/src/mutation_log.cc:322
Fix by using std::copy instead.
Change-Id: I0994f1522efeb046c58da375053b6257fdc89a6a
Reviewed-on: http://review.couchbase.org/93762
Tested-by: Build Bot <[email protected]>
Reviewed-by: Trond Norbye <[email protected]>
0 commit comments