From 48853e73493fd5ca74294baff0ab5c2da5c3059f Mon Sep 17 00:00:00 2001
From: Dominik Loidolt <dominik.loidolt@univie.ac.at>
Date: Mon, 3 Oct 2022 17:21:58 +0200
Subject: [PATCH] fix a overflow

---
 lib/cmp_icu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cmp_icu.c b/lib/cmp_icu.c
index 79d1a64..5995afb 100644
--- a/lib/cmp_icu.c
+++ b/lib/cmp_icu.c
@@ -142,7 +142,7 @@ uint32_t cmp_cfg_icu_buffers(struct cmp_cfg *cfg, void *data_to_compress,
 	data_size = cmp_cal_size_of_data(compressed_data_len_samples, cfg->data_type);
 	hdr_size = cmp_ent_cal_hdr_size(cfg->data_type, cfg->cmp_mode == CMP_MODE_RAW);
 
-	if ((data_size + hdr_size) > CMP_ENTITY_MAX_SIZE) {
+	if ((data_size + hdr_size) > CMP_ENTITY_MAX_SIZE || data_size > CMP_ENTITY_MAX_SIZE) {
 		debug_print("Error: The buffer for the compressed data is too large to fit in a compression entity.\n");
 		return 0;
 	}
-- 
GitLab