Skip to content

Commit

Permalink
save cgats to memory was wrong for one byte
Browse files Browse the repository at this point in the history
The ending zero was not properly counted. Fixed.
  • Loading branch information
mm2 committed Jan 10, 2023
1 parent 3939d5c commit e71aeb6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cmscgats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1939,13 +1939,15 @@ cmsBool CMSEXPORT cmsIT8SaveToMem(cmsHANDLE hIT8, void *MemPtr, cmsUInt32Number*
memset(&sd, 0, sizeof(sd));

sd.stream = NULL;
sd.Base = (cmsUInt8Number*) MemPtr;
sd.Base = (cmsUInt8Number*) MemPtr;
sd.Ptr = sd.Base;

sd.Used = 0;

if (sd.Base)
sd.Max = *BytesNeeded; // Write to memory?
if (sd.Base && (*BytesNeeded > 0)) {

sd.Max = (*BytesNeeded) - 1; // Write to memory?
}
else
sd.Max = 0; // Just counting the needed bytes

Expand Down

0 comments on commit e71aeb6

Please sign in to comment.