mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add limit parameter to decompressZlib
This can prevent untrusted data, such as sent over the network, from consuming all memory with a specially crafted payload.
This commit is contained in:
parent
1116918dbb
commit
2b3490db1f
3 changed files with 81 additions and 4 deletions
|
@ -87,7 +87,7 @@ inline bool ser_ver_supported(s32 v) {
|
|||
|
||||
void compressZlib(const u8 *data, size_t data_size, std::ostream &os, int level = -1);
|
||||
void compressZlib(const std::string &data, std::ostream &os, int level = -1);
|
||||
void decompressZlib(std::istream &is, std::ostream &os);
|
||||
void decompressZlib(std::istream &is, std::ostream &os, size_t limit = 0);
|
||||
|
||||
// These choose between zlib and a self-made one according to version
|
||||
void compress(const SharedBuffer<u8> &data, std::ostream &os, u8 version);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue