2 Commits

Author SHA1 Message Date
Mark Mandriota
f1cb0172d1 fix: segmentation fault, non initialized pointers in dictziplib.hpp
In method void DictData::close() both if (this->chunks) and if (this->offsets) checks can pass even if no allocated memory is assigned to pointers, because both pointers were not initialized to anything, it is UB, so free were called on uninitialized values. Initializing both values to nullptr guarantees that both checks will fail if pointers were not modified, and free is not called.
2025-12-17 10:55:59 +03:00
Mark Mandriota
bae2132bd5 fix: segmentation fault, non initialized pointers in dictziplib.hpp
In method void DictData::close() both if (this->chunks) and if (this->offsets) checks can pass even if no allocated memory is assigned to pointers, because both pointers were not initialized to anything, it is UB, so free were called on uninitialized values. Initializing both values to nullptr guarantees that both checks will fail if pointers were not modified, and free is not called.
2025-12-17 10:55:59 +03:00

View File

@@ -42,8 +42,8 @@ private:
int version; int version;
int chunkLength; int chunkLength;
int chunkCount; int chunkCount;
int *chunks; int *chunks = nullptr;
unsigned long *offsets; /* Sum-scan of chunks. */ unsigned long *offsets = nullptr; /* Sum-scan of chunks. */
std::string origFilename; std::string origFilename;
std::string comment; std::string comment;
unsigned long crc; unsigned long crc;