Skip to content

Commit 4f613d7

Browse files
committed
Fix for heap buffer overflow write in IT8/CGATS parser due to failed suballocator growth
Not exploitable directly because the CGATS parser is never used on ICC workflows. May affect tools.
1 parent 857a534 commit 4f613d7

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/cmscgats.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,19 +1245,26 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size)
12451245

12461246
it8 ->Allocator.Used = 0;
12471247
new_block = (cmsUInt8Number*)AllocBigBlock(it8, it8->Allocator.BlockSize);
1248-
if (new_block == NULL)
1249-
return NULL;
1248+
if (new_block == NULL) goto Error;
12501249

12511250
it8->Allocator.Block = new_block;
12521251
}
12531252

12541253
if (it8->Allocator.Block == NULL)
1255-
return NULL;
1254+
goto Error;
12561255

12571256
ptr = it8 ->Allocator.Block + it8 ->Allocator.Used;
12581257
it8 ->Allocator.Used += size;
12591258

12601259
return (void*) ptr;
1260+
1261+
Error:
1262+
1263+
SynError(it8, "Allocation error");
1264+
it8->Allocator.BlockSize = 0;
1265+
it8->Allocator.Used = 0;
1266+
it8->Allocator.Block = NULL;
1267+
return NULL;
12611268
}
12621269

12631270

0 commit comments

Comments
 (0)