Skip to content

Commit 1a94f90

Browse files
committed
TCP input: fix possible buffer overflow in Lz4 decoder
1 parent 304010e commit 1a94f90

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/plugins/input/tcp/src/Lz4Decoder.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ void Lz4Decoder::decompress() {
147147
m_decompressed_pos = 0;
148148
}
149149

150+
if (m_decompressed_size > m_decompressed.size() - m_decompressed_pos) {
151+
throw std::runtime_error("LZ4 Decoder: invalid decompressed size");
152+
}
153+
150154
int res = LZ4_decompress_safe_continue(
151155
m_decoder.get(),
152156
reinterpret_cast<char *>(m_compressed.data()),

0 commit comments

Comments
 (0)