pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Dwrite/ClickHouse/commit/313e9c54b2d97bdfd9fa62cbfd1456558fc096b3

crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-9c8f61f9f58ad7b2.css" /> Merge pull request #84320 from scanhex12/yet_another_fix · Dwrite/ClickHouse@313e9c5 · GitHub
Skip to content

Commit 313e9c5

Browse files
Merge pull request ClickHouse#84320 from scanhex12/yet_another_fix
Yet another sz3 fuzzer compression fix
2 parents 5c96ecf + 95923e2 commit 313e9c5

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/Compression/CompressionCodecSZ3.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ UInt32 CompressionCodecSZ3::doCompressData(const char * source, UInt32 source_si
153153
size_t compressed_size;
154154
switch (float_width)
155155
{
156-
case 4: {
156+
case 4:
157+
{
157158
try
158159
{
159160
compressed.reset(SZ_compress(config, reinterpret_cast<const float *>(source), compressed_size));
@@ -164,7 +165,8 @@ UInt32 CompressionCodecSZ3::doCompressData(const char * source, UInt32 source_si
164165
}
165166
break;
166167
}
167-
case 8: {
168+
case 8:
169+
{
168170
try
169171
{
170172
compressed.reset(SZ_compress(config, reinterpret_cast<const double *>(source), compressed_size));
@@ -196,8 +198,10 @@ void CompressionCodecSZ3::setAndCheckVectorDimension(size_t dimension_)
196198

197199
void CompressionCodecSZ3::doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 /*uncompressed_size*/) const
198200
{
199-
if (source_size == 0)
200-
throw Exception(ErrorCodes::CORRUPTED_DATA, "Can not decompress empty data");
201+
/// Hardcoded, because it is not declared (we just calculated the minimal size of decompressed config) and it is less than sizeof(SZ3::Config).
202+
static constexpr const size_t config_size = 39;
203+
if (source_size < 1 + config_size)
204+
throw Exception(ErrorCodes::CORRUPTED_DATA, "Can not decompress data {} that is less than minimal size of compressed", source_size);
201205

202206
UInt8 width = static_cast<UInt8>(*source);
203207
--source_size;
@@ -206,7 +210,8 @@ void CompressionCodecSZ3::doDecompressData(const char * source, UInt32 source_si
206210
SZ3::Config config;
207211
switch (width)
208212
{
209-
case 4: {
213+
case 4:
214+
{
210215
try
211216
{
212217
float * dest_typed = reinterpret_cast<float *>(dest);
@@ -218,7 +223,8 @@ void CompressionCodecSZ3::doDecompressData(const char * source, UInt32 source_si
218223
}
219224
break;
220225
}
221-
case 8: {
226+
case 8:
227+
{
222228
try
223229
{
224230
double * dest_typed = reinterpret_cast<double *>(dest);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy