From 6d36466414db8a17767a2d8340b59ca538c2303b Mon Sep 17 00:00:00 2001 From: xkernel Date: Sat, 13 Apr 2024 10:10:44 +0800 Subject: [PATCH] Let the IOhandler successfully created by cmsOpenIOhandlerFromMem always has a valid Block --- src/cmsio0.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmsio0.c b/src/cmsio0.c index 75442e66..b04c28f3 100644 --- a/src/cmsio0.c +++ b/src/cmsio0.c @@ -277,6 +277,11 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buff fm = (FILEMEM*) _cmsMallocZero(ContextID, sizeof(FILEMEM)); if (fm == NULL) goto Error; + if (Buffer == NULL) { + cmsSignalError(ContextID, cmsERROR_WRITE, "Couldn't write profile to NULL pointer"); + goto Error; + } + fm ->Block = (cmsUInt8Number*) Buffer; fm ->FreeBlockOnClose = FALSE; fm ->Size = size;