Skip to content

Commit 5b08385

Browse files
committed
prevent to allocate a big chunk of memory on corrupted LUT
Overflow here is harmless, but caller code may try to allocate a big chunk of memory, which will be immediatly freed because file size does not match.
1 parent b0541c2 commit 5b08385

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cmslut.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ cmsUInt32Number CubeSize(const cmsUInt32Number Dims[], cmsUInt32Number b)
475475
if (rv > UINT_MAX / dim) return 0;
476476
}
477477

478+
// Again, prevent overflow
479+
if (rv > UINT_MAX / 15) return 0;
480+
478481
return rv;
479482
}
480483

0 commit comments

Comments
 (0)