rocksdb: don't call LZ4_loadDictHC with null dictionary
Summary: UBSAN revealed a pointer underflow when `LZ4HC_init_internal` is called with a null `start`. Reviewed By: ajkr Differential Revision: D30181874 fbshipit-source-id: ca9bbac1a85c58782871d7f153af733b000cc66c
This commit is contained in:
parent
2dea3dd258
commit
c3034fce32
@ -1224,8 +1224,10 @@ inline bool LZ4HC_Compress(const CompressionInfo& info,
|
|||||||
const char* compression_dict_data =
|
const char* compression_dict_data =
|
||||||
compression_dict.size() > 0 ? compression_dict.data() : nullptr;
|
compression_dict.size() > 0 ? compression_dict.data() : nullptr;
|
||||||
size_t compression_dict_size = compression_dict.size();
|
size_t compression_dict_size = compression_dict.size();
|
||||||
|
if (compression_dict_data != nullptr) {
|
||||||
LZ4_loadDictHC(stream, compression_dict_data,
|
LZ4_loadDictHC(stream, compression_dict_data,
|
||||||
static_cast<int>(compression_dict_size));
|
static_cast<int>(compression_dict_size));
|
||||||
|
}
|
||||||
|
|
||||||
#if LZ4_VERSION_NUMBER >= 10700 // r129+
|
#if LZ4_VERSION_NUMBER >= 10700 // r129+
|
||||||
outlen =
|
outlen =
|
||||||
|
Loading…
Reference in New Issue
Block a user