From 4125b24356502478833ed44a323c5766f7a45d29 Mon Sep 17 00:00:00 2001 From: Yevhen Kozirovskyi Date: Sun, 19 Jan 2025 16:58:09 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20sk1/compressor.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sk1/compressor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sk1/compressor.c b/sk1/compressor.c index 8db8eff..3429d0d 100644 --- a/sk1/compressor.c +++ b/sk1/compressor.c @@ -133,7 +133,9 @@ void storeCodes(struct MinHeapNode* root, char** codes, char* currentCode, int t } if (!(root->left) && !(root->right)) { currentCode[top] = '\0'; + if (root->data < 256) { // Ensure data is within bounds codes[root->data] = strdup(currentCode); + } } } // Compress the input file using Huffman Coding