File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -142,9 +142,9 @@ Table of Contents
142142
1431432. Network Packet Global Structure
144144
145- The packet are send compressed thanks to zstd library over the network
146- with the UDP protocol. And the packet are decompressed thanks to zstd
147- when received.
145+ The packets are compressed using the zstd library before being sent over
146+ the network using the UDP protocol. Upon receipt, the packets are
147+ decompressed using the zstd library
148148 To add some better reliability, each packet sent has a header with some
149149 information about all the packets received.
150150
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ namespace Nitwork {
2222 if (!std::is_standard_layout_v<T> || !std::is_trivial_v<T>) {
2323 throw std::runtime_error (" ZSTD: Data must be POD" );
2424 }
25+ if (sizeof (T) > ZSTD_compressBound (sizeof (T))) {
26+ throw std::runtime_error (" ZSTD: Input data is too large" );
27+ }
2528 size_t const compressedSize = ZSTD_compressBound (sizeof (T));
2629 std::vector<char > compressedData (compressedSize);
2730 size_t const result = ZSTD_compress (
You can’t perform that action at this time.
0 commit comments