3 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
Vitaly Zdanevich
5478f290a1 README.org: fzf example: preview window make bigger
Was 50%:50% and by UX we do not need the half of the screen for the dictionary name.
2025-10-07 23:44:02 +03:00
2 changed files with 3 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ fzf --prompt="Dict: " \
--phony \ --phony \
--bind "enter:reload(sdcv {q} -n --json | jq '.[].dict' -r)" \ --bind "enter:reload(sdcv {q} -n --json | jq '.[].dict' -r)" \
--preview "sdcv {q} -en --use-dict={}" \ --preview "sdcv {q} -en --use-dict={}" \
--preview-window=wrap \ --preview-window=right:70%:wrap \
< <(echo) < <(echo)
#+END_SRC #+END_SRC

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;