diff --git a/lib/icu_compress/cmp_icu.c b/lib/icu_compress/cmp_icu.c index 5e6f13fa6a7ee2c2e1628989ac3eb72b04e3232f..1f217a03601b07b35750d7b6c5ef71d60fe9858b 100644 --- a/lib/icu_compress/cmp_icu.c +++ b/lib/icu_compress/cmp_icu.c @@ -466,10 +466,8 @@ static int put_n_bits32(uint32_t value, unsigned int n_bits, int bit_offset, return stream_len; /* Check if bitstream buffer is large enough */ - if ((unsigned int)stream_len > max_stream_len) { - debug_print("Error: The buffer for the compressed data is too small to hold the compressed data. Try a larger buffer_length parameter.\n"); + if ((unsigned int)stream_len > max_stream_len) return CMP_ERROR_SMALL_BUF; - } local_adr = bitstream_adr + (bit_offset >> 5); diff --git a/programs/cmp_tool.c b/programs/cmp_tool.c index c70c7bf7342d80f14687044062fa5e3bc61f7726..9560c9da244d92f316c64ded1c540de162b5048c 100644 --- a/programs/cmp_tool.c +++ b/programs/cmp_tool.c @@ -773,8 +773,11 @@ static int compression(struct cmp_cfg *cfg, struct cmp_info *info) cfg->icu_output_buf = cmp_ent_get_data_buf(cmp_entity); cmp_size = icu_compress_data(cfg); - if (cmp_size < 0) + if (cmp_size < 0) { + if (cmp_size == CMP_ERROR_SMALL_BUF) + fprintf(stderr, "Error: The buffer for the compressed data is too small to hold the compressed data. Try a larger buffer_length parameter.\n"); goto error_cleanup; + } if (model_id_str) { uint32_t red_val;