Skip to content

Commit

Permalink
Merge pull request #60 from amondonedo/master
Browse files Browse the repository at this point in the history
Updated LZ4 version 1.9.2
  • Loading branch information
Enmk authored Jan 9, 2021
2 parents d070906 + 86fddbb commit 9d8b99d
Show file tree
Hide file tree
Showing 7 changed files with 3,942 additions and 1,580 deletions.
2 changes: 1 addition & 1 deletion clickhouse/base/compressed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool CompressedInput::Decompress() {

data_ = Buffer(original);

if (LZ4_decompress_fast((const char*)tmp.data() + 9, (char*)data_.data(), original) < 0) {
if (LZ4_decompress_safe((const char*)tmp.data() + 9, (char*)data_.data(), compressed - 9, original) < 0) {
throw std::runtime_error("can't decompress data");
} else {
mem_.Reset(data_.data(), original);
Expand Down
2 changes: 1 addition & 1 deletion clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void Client::Impl::SendData(const Block& block) {
buf.resize(9 + LZ4_compressBound(tmp.size()));

// Compress data
int size = LZ4_compress((const char*)tmp.data(), (char*)buf.data() + 9, tmp.size());
int size = LZ4_compress_default((const char*)tmp.data(), (char*)buf.data() + 9, tmp.size(), buf.size() - 9);
buf.resize(9 + size);

// Fill header
Expand Down
2 changes: 1 addition & 1 deletion contrib/lz4/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LZ4 Library
Copyright (c) 2011-2014, Yann Collet
Copyright (c) 2011-2016, Yann Collet
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
Loading

0 comments on commit 9d8b99d

Please sign in to comment.