Fix UBSAN report
/home/anoyes/workspace/foundationdb/fdbclient/SnapshotCache.h:44:10: runtime error: null pointer passed as argument 2, which is declared to never be null
This commit is contained in:
parent
560c1da805
commit
cc170fe8d8
|
@ -41,7 +41,9 @@ struct ExtStringRef {
|
||||||
StringRef toArenaOrRef( Arena& a ) {
|
StringRef toArenaOrRef( Arena& a ) {
|
||||||
if (extra_zero_bytes) {
|
if (extra_zero_bytes) {
|
||||||
StringRef dest = StringRef( new(a) uint8_t[ size() ], size() );
|
StringRef dest = StringRef( new(a) uint8_t[ size() ], size() );
|
||||||
memcpy( mutateString(dest), base.begin(), base.size() );
|
if (base.size()) {
|
||||||
|
memcpy(mutateString(dest), base.begin(), base.size());
|
||||||
|
}
|
||||||
memset( mutateString(dest)+base.size(), 0, extra_zero_bytes );
|
memset( mutateString(dest)+base.size(), 0, extra_zero_bytes );
|
||||||
return dest;
|
return dest;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue