summaryrefslogtreecommitdiff
path: root/third_party/lcms/0025-upstream-direct-leak-Type_MPE_Read.patch
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/lcms/0025-upstream-direct-leak-Type_MPE_Read.patch')
-rw-r--r--third_party/lcms/0025-upstream-direct-leak-Type_MPE_Read.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/third_party/lcms/0025-upstream-direct-leak-Type_MPE_Read.patch b/third_party/lcms/0025-upstream-direct-leak-Type_MPE_Read.patch
new file mode 100644
index 0000000000..339333188a
--- /dev/null
+++ b/third_party/lcms/0025-upstream-direct-leak-Type_MPE_Read.patch
@@ -0,0 +1,31 @@
+diff --git a/third_party/lcms/src/cmstypes.c b/third_party/lcms/src/cmstypes.c
+index 75f1fae32..f92a92822 100644
+--- a/third_party/lcms/src/cmstypes.c
++++ b/third_party/lcms/src/cmstypes.c
+@@ -4460,18 +4460,19 @@ void *Type_MPE_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsU
+ NewLUT = cmsPipelineAlloc(self ->ContextID, InputChans, OutputChans);
+ if (NewLUT == NULL) return NULL;
+
+- if (!_cmsReadUInt32Number(io, &ElementCount)) return NULL;
+-
+- if (!ReadPositionTable(self, io, ElementCount, BaseOffset, NewLUT, ReadMPEElem)) {
+- if (NewLUT != NULL) cmsPipelineFree(NewLUT);
+- *nItems = 0;
+- return NULL;
+- }
++ if (!_cmsReadUInt32Number(io, &ElementCount)) goto Error;
++ if (!ReadPositionTable(self, io, ElementCount, BaseOffset, NewLUT, ReadMPEElem)) goto Error;
+
+ // Success
+ *nItems = 1;
+ return NewLUT;
+
++ // Error
++Error:
++ if (NewLUT != NULL) cmsPipelineFree(NewLUT);
++ *nItems = 0;
++ return NULL;
++
+ cmsUNUSED_PARAMETER(SizeOfTag);
+ }
+