diff --git a/programs/cmp_io.c b/programs/cmp_io.c
index c4668ada6521d468c64ce2883e40ac51dbe9061d..ba6413e53c9e8d4006b26c9c9f44825ebeee102e 100644
--- a/programs/cmp_io.c
+++ b/programs/cmp_io.c
@@ -1315,7 +1315,7 @@ static __inline ssize_t str2uint8_arr(const char *str, uint8_t *data, uint32_t b
 			nptr++;
 	}
 	if (*nptr != '\0') {
-		fprintf(stderr, "%s: %s: Warning: The file may contain more data than specified by the samples or cmp_size parameter.\n",
+		fprintf(stderr, "%s: %s: Warning: The file may contain more data than read from it.\n",
 			PROGRAM_NAME, file_name);
 	}
 
diff --git a/programs/cmp_tool.c b/programs/cmp_tool.c
index f7457fa157c40aa92f0eed0f8526df88d1e7f493..89df5ec22bc6a7f35235002bd16c3184c08e8c9b 100644
--- a/programs/cmp_tool.c
+++ b/programs/cmp_tool.c
@@ -537,6 +537,19 @@ int CMP_MAIN(int argc, char **argv)
 		else
 			model_size = cmp_ent_get_original_size(decomp_entity);
 
+		size = read_file_data(model_file_name, cmp_type, NULL,
+				      model_size, io_flags);
+		if (size < 0)
+			goto fail;
+		if (size < (ssize_t)model_size) {
+			fprintf(stderr, "%s: %s: Error: The files do not contain enough data. Expected: 0x%x, has 0x%x.\n",
+				PROGRAM_NAME, model_file_name, model_size, (uint32_t)size);
+			goto fail;
+		}
+		if (size != (ssize_t)model_size) {
+			fprintf(stderr, "%s: %s: Error: Model file size does not match original data size.\n", PROGRAM_NAME, model_file_name);
+			goto fail;
+		}
 
 		input_model_buf = malloc(model_size);
 		if (!input_model_buf) {
@@ -548,10 +561,7 @@ int CMP_MAIN(int argc, char **argv)
 				      model_size, io_flags);
 		if (size < 0)
 			goto fail;
-		if (size != (ssize_t)model_size) {
-			fprintf(stderr, "%s: %s: Error: Model file size does not match original data size.\n", PROGRAM_NAME, model_file_name);
-			goto fail;
-		}
+
 
 		printf("DONE\n");
 
diff --git a/test/cmp_tool/cmp_tool_integration_test.py b/test/cmp_tool/cmp_tool_integration_test.py
index 3f7e00418dabaa60380f71183369920a23caf977..e0e3fbe7afe1f4399dd4b1185e7d3347c3b6e24c 100755
--- a/test/cmp_tool/cmp_tool_integration_test.py
+++ b/test/cmp_tool/cmp_tool_integration_test.py
@@ -1331,7 +1331,7 @@ def test_model_fiel_erros():
         del_file(output_prefix+"_upmodel.dat")
 
 
-def test_decmp_model_fiel_original_size_miss_match():
+def test_decmp_model_fiel_original_size_miss_match_binary():
     cmp_data = b'8000000d000029000004097ce800cbd5097ce800cbfe00010108d01001000000001001001110078700'
     to_large_model = b'111111111111' # should be 4 byte large in normal case
     output_prefix = 'model_file_to_large'
@@ -1356,6 +1356,37 @@ def test_decmp_model_fiel_original_size_miss_match():
     finally:
         del_file(cmp_data_file_name)
         del_file(model_file_name)
+        del_file(output_prefix+'.dat')
+        del_file(output_prefix+'_upmodel.dat')
+
+
+def test_decmp_model_fiel_original_size_miss_match_binary():
+    cmp_data = '8000000d000029000004097ce800cbd5097ce800cbfe00010108d01001000000001001001110078700'
+    to_large_model = '111111111111' # should be 4 byte large in normal case
+    output_prefix = 'model_file_to_large'
+    cmp_data_file_name = 'cmp_data.cmp'
+    model_file_name = 'to_large_model.dat'
+
+    try:
+        with open(cmp_data_file_name, 'w', encoding='utf-8') as f:
+            f.write(cmp_data)
+
+        with open(model_file_name, 'w', encoding='utf-8') as f:
+            f.write(to_large_model)
+
+        returncode, stdout, stderr = call_cmp_tool(
+            " -d "+cmp_data_file_name + " -m " + model_file_name + " -o "+output_prefix)
+        assert(returncode == EXIT_FAILURE)
+        assert(stdout == CMP_START_STR_DECMP +
+               "Importing compressed data file %s ... DONE\n" % (cmp_data_file_name) +
+               "Importing model file %s ... FAILED\n" % (model_file_name))
+        assert(stderr == "cmp_tool: %s: Error: Model file size does not match original data size.\n" % (model_file_name))
+
+    finally:
+         del_file(cmp_data_file_name)
+         del_file(model_file_name)
+         del_file(output_prefix+'.dat')
+         del_file(output_prefix+'_upmodel.dat')
 
 
 def test_rdcu_pkt():