summaryrefslogtreecommitdiff
path: root/third_party/lcms/0008-infinite-loop-GrowNamedColorList.patch
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/lcms/0008-infinite-loop-GrowNamedColorList.patch')
-rw-r--r--third_party/lcms/0008-infinite-loop-GrowNamedColorList.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/third_party/lcms/0008-infinite-loop-GrowNamedColorList.patch b/third_party/lcms/0008-infinite-loop-GrowNamedColorList.patch
new file mode 100644
index 0000000000..eabf6a938d
--- /dev/null
+++ b/third_party/lcms/0008-infinite-loop-GrowNamedColorList.patch
@@ -0,0 +1,28 @@
+diff --git a/third_party/lcms/src/cmsnamed.c b/third_party/lcms/src/cmsnamed.c
+index 9b27ca0cc..9ed4cad39 100644
+--- a/third_party/lcms/src/cmsnamed.c
++++ b/third_party/lcms/src/cmsnamed.c
+@@ -540,7 +540,10 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsContext ContextID, cmsUIn
+ v ->ContextID = ContextID;
+
+ while (v -> Allocated < n){
+- if (!GrowNamedColorList(v)) return NULL;
++ if (!GrowNamedColorList(v)) {
++ cmsFreeNamedColorList(v);
++ return NULL;
++ }
+ }
+
+ strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1);
+@@ -571,7 +574,10 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v)
+
+ // For really large tables we need this
+ while (NewNC ->Allocated < v ->Allocated){
+- if (!GrowNamedColorList(NewNC)) return NULL;
++ if (!GrowNamedColorList(NewNC)) {
++ cmsFreeNamedColorList(NewNC);
++ return NULL;
++ }
+ }
+
+ memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix));