summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iccread.c4
-rw-r--r--invalid-coverage.c3
-rw-r--r--sample-trunc.iccbin0 -> 73 bytes
3 files changed, 6 insertions, 1 deletions
diff --git a/iccread.c b/iccread.c
index c721fbe..63029ae 100644
--- a/iccread.c
+++ b/iccread.c
@@ -765,8 +765,10 @@ qcms_profile* qcms_profile_from_file(FILE *file)
/* read the rest profile */
read_length = fread((unsigned char*)data + sizeof(length_be), 1, remaining_length, file);
- if (read_length != remaining_length)
+ if (read_length != remaining_length) {
+ free(data);
return INVALID_PROFILE;
+ }
profile = qcms_profile_from_memory(data, length);
free(data);
diff --git a/invalid-coverage.c b/invalid-coverage.c
index 312515b..c402252 100644
--- a/invalid-coverage.c
+++ b/invalid-coverage.c
@@ -153,6 +153,9 @@ int main()
write_u32(128 + 4 + 4*6*3 + 4, 1100); // offset
qcms_profile_release(qcms_profile_from_memory(buf, 1500));
+ /* test out profiles that are the wrong size */
+ qcms_profile_from_path("sample-trunc.icc");
+
return 0;
}
diff --git a/sample-trunc.icc b/sample-trunc.icc
new file mode 100644
index 0000000..8a41f39
--- /dev/null
+++ b/sample-trunc.icc
Binary files differ