Skip to content

Commit

Permalink
Fix a possible overflow on crafted CGATS files
Browse files Browse the repository at this point in the history
we now only allow rows * colums  < 200,000 items which seems reasonable
  • Loading branch information
mm2 committed Apr 11, 2024
1 parent 4635588 commit af6c565
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cmscgats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,8 @@ cmsBool AllocateDataSet(cmsIT8* it8)
t-> nSamples = satoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
t-> nPatches = satoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS"));

if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)
if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe ||
(t->nPatches * t->nSamples) > 200000)
{
SynError(it8, "AllocateDataSet: too much data");
return FALSE;
Expand Down

0 comments on commit af6c565

Please sign in to comment.