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
main
Lucian Grijincu 3 years ago committed by Facebook GitHub Bot
parent 61f83dfeb7
commit a756fb9c85
  1. 6
      util/compression.h

@ -1224,8 +1224,10 @@ inline bool LZ4HC_Compress(const CompressionInfo& info,
const char* compression_dict_data =
compression_dict.size() > 0 ? compression_dict.data() : nullptr;
size_t compression_dict_size = compression_dict.size();
LZ4_loadDictHC(stream, compression_dict_data,
static_cast<int>(compression_dict_size));
if (compression_dict_data != nullptr) {
LZ4_loadDictHC(stream, compression_dict_data,
static_cast<int>(compression_dict_size));
}
#if LZ4_VERSION_NUMBER >= 10700 // r129+
outlen =

Loading…
Cancel
Save