diff options
author | Marti Maria <info@littlecms.com> | 2018-08-15 20:07:56 +0200 |
---|---|---|
committer | Marti Maria <info@littlecms.com> | 2018-08-15 20:07:56 +0200 |
commit | 768f70ca405cd3159d990e962d54456773bb8cf8 (patch) | |
tree | 4e73cfb74bf189257c30d6b309fe278339eaa565 /src | |
parent | c2a1cd9c929952c5aeca8fee91649a83e8fc8021 (diff) | |
download | lcms2-768f70ca405cd3159d990e962d54456773bb8cf8.tar.gz |
Upgrade Visual studio 2017 15.8
- Upgrade to 15.8
- Add check on CGATS memory allocation (thanks to Quang Nguyen for
pointing out this)
Diffstat (limited to 'src')
-rw-r--r-- | src/cmscgats.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cmscgats.c b/src/cmscgats.c index 1a87613..8c3e96d 100644 --- a/src/cmscgats.c +++ b/src/cmscgats.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2018 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -1506,10 +1506,16 @@ void AllocateDataSet(cmsIT8* it8) t-> nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS")); t-> nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS")); - t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nPatches + 1) *sizeof (char*)); - if (t->Data == NULL) { + if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe) + { + SynError(it8, "AllocateDataSet: too much data"); + } + else { + t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*)); + if (t->Data == NULL) { - SynError(it8, "AllocateDataSet: Unable to allocate data array"); + SynError(it8, "AllocateDataSet: Unable to allocate data array"); + } } } |