diff options
author | AlexSm <alex@ydb.tech> | 2023-12-21 15:05:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 15:05:38 +0100 |
commit | e98bcbc74422492351c51646dba3849a138a8ffc (patch) | |
tree | 38ad7a09b1f9c201ce8a7e3d69f2017388769224 /contrib/libs/lcms2/src/cmserr.c | |
parent | 559d7083cd8378cb25b9e966dedcca21d413e338 (diff) | |
download | ydb-e98bcbc74422492351c51646dba3849a138a8ffc.tar.gz |
Import libs 1 (#590)
* Import libs 1
* Add new file without extension
* Add file missed in export config
Diffstat (limited to 'contrib/libs/lcms2/src/cmserr.c')
-rw-r--r-- | contrib/libs/lcms2/src/cmserr.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/libs/lcms2/src/cmserr.c b/contrib/libs/lcms2/src/cmserr.c index ccb40f9261..811c63502d 100644 --- a/contrib/libs/lcms2/src/cmserr.c +++ b/contrib/libs/lcms2/src/cmserr.c @@ -72,7 +72,7 @@ long int CMSEXPORT cmsfilelength(FILE* f) // // This is the interface to low-level memory management routines. By default a simple // wrapping to malloc/free/realloc is provided, although there is a limit on the max -// amount of memoy that can be reclaimed. This is mostly as a safety feature to prevent +// amount of memory that can be reclaimed. This is mostly as a safety feature to prevent // bogus or evil code to allocate huge blocks that otherwise lcms would never need. #define MAX_MEMORY_FOR_ALLOC ((cmsUInt32Number)(1024U*1024U*512U)) @@ -92,7 +92,8 @@ cmsBool _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plug static void* _cmsMallocDefaultFn(cmsContext ContextID, cmsUInt32Number size) { - if (size > MAX_MEMORY_FOR_ALLOC) return NULL; // Never allow over maximum + // Never allow 0 or over maximum + if (size == 0 || size > MAX_MEMORY_FOR_ALLOC) return NULL; return (void*) malloc(size); @@ -234,7 +235,7 @@ cmsBool _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase *Data) // NULL forces to reset to defaults. In this special case, the defaults are stored in the context structure. // Remaining plug-ins does NOT have any copy in the context structure, but this is somehow special as the - // context internal data should be malloce'd by using those functions. + // context internal data should be malloc'ed by using those functions. if (Data == NULL) { struct _cmsContext_struct* ctx = ( struct _cmsContext_struct*) ContextID; |