Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -638,7 +638,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