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-09-01 22:00:49 +0300
committerMarti Maria <marti.maria@littlecms.com>2022-09-01 22:00:49 +0300
commitad121a18594e496d0b76328d08403ea0bd304183 (patch)
treebbbd2adc28aa5651a804123f249dd917a9210e85
parent991713e8456e62de82793e0594997fe997045431 (diff)
Add more protection against attacks
More code to filter bad API use
-rw-r--r--src/cmspack.c5
-rw-r--r--src/cmsxform.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/cmspack.c b/src/cmspack.c
index 2177682..3982cc5 100644
--- a/src/cmspack.c
+++ b/src/cmspack.c
@@ -3805,6 +3805,11 @@ cmsFormatter CMSEXPORT _cmsGetFormatter(cmsContext ContextID,
_cmsFormattersPluginChunkType* ctx = ( _cmsFormattersPluginChunkType*) _cmsContextGetClientChunk(ContextID, FormattersPlugin);
cmsFormattersFactoryList* f;
+ if (T_CHANNELS(Type) == 0) {
+ static const cmsFormatter nullFormatter = { 0 };
+ return nullFormatter;
+ }
+
for (f =ctx->FactoryList; f != NULL; f = f ->Next) {
cmsFormatter fn = f ->Factory(Type, Dir, dwFlags);
diff --git a/src/cmsxform.c b/src/cmsxform.c
index 0b709b5..38ea624 100644
--- a/src/cmsxform.c
+++ b/src/cmsxform.c
@@ -960,7 +960,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
return NULL;
}
- BytesPerPixelInput = T_BYTES(p ->InputFormat);
+ BytesPerPixelInput = T_BYTES(*InputFormat);
if (BytesPerPixelInput == 0 || BytesPerPixelInput >= 2)
*dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;