Skip to content

Commit

Permalink
rocksdb: don't call LZ4_loadDictHC with null dictionary
Browse files Browse the repository at this point in the history
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
  • Loading branch information
luciang authored and ajkr committed Aug 9, 2021
1 parent 2dea3dd commit c3034fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions util/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit c3034fc

Please sign in to comment.