Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mm2/Little-CMS.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarti Maria <marti.maria@littlecms.com>2022-07-26 09:53:11 +0300
committerMarti Maria <marti.maria@littlecms.com>2022-07-26 09:53:11 +0300
commitb7e119beadd56e5d6aefcf4a3edee33dc78c92c6 (patch)
tree65322de5e6c64a32dd56f2eefadce653e98056dc
parent77758b7f815f4ced91e088ce855b31c90ad0a406 (diff)
Check for duplicated tags
If so, discard profile
-rw-r--r--src/cmscnvrt.c2
-rw-r--r--src/cmsio0.c17
2 files changed, 16 insertions, 3 deletions
diff --git a/src/cmscnvrt.c b/src/cmscnvrt.c
index fe25525..abac021 100644
--- a/src/cmscnvrt.c
+++ b/src/cmscnvrt.c
@@ -386,7 +386,7 @@ cmsBool ComputeConversion(cmsUInt32Number i,
if (BPC) {
- cmsCIEXYZ BlackPointIn, BlackPointOut;
+ cmsCIEXYZ BlackPointIn = { 0, 0, 0}, BlackPointOut = { 0, 0, 0 };
cmsDetectBlackPoint(&BlackPointIn, hProfiles[i-1], Intent, 0);
cmsDetectDestinationBlackPoint(&BlackPointOut, hProfiles[i], Intent, 0);
diff --git a/src/cmsio0.c b/src/cmsio0.c
index f02d240..9c07aa1 100644
--- a/src/cmsio0.c
+++ b/src/cmsio0.c
@@ -815,11 +815,11 @@ cmsBool _cmsReadHeader(_cmsICCPROFILE* Icc)
// Search for links
for (j=0; j < Icc ->TagCount; j++) {
-
+
if ((Icc ->TagOffsets[j] == Tag.offset) &&
(Icc ->TagSizes[j] == Tag.size)) {
- // Check types. Abort whole profile if a forged link is found
+ // Check types.
if (CompatibleTypes(_cmsGetTagDescriptor(Icc->ContextID, Icc->TagNames[j]),
_cmsGetTagDescriptor(Icc->ContextID, Tag.sig))) {
@@ -832,6 +832,19 @@ cmsBool _cmsReadHeader(_cmsICCPROFILE* Icc)
Icc ->TagCount++;
}
+
+ for (i = 0; i < Icc->TagCount; i++) {
+ for (j = 0; j < Icc->TagCount; j++) {
+
+ // Tags cannot be duplicate
+ if ((i != j) && (Icc->TagNames[i] == Icc->TagNames[j])) {
+ cmsSignalError(Icc->ContextID, cmsERROR_RANGE, "Duplicate tag found");
+ return FALSE;
+ }
+
+ }
+ }
+
return TRUE;
}