diff options
author | Marti Maria <info@littlecms.com> | 2013-07-29 18:59:20 +0200 |
---|---|---|
committer | Marti Maria <info@littlecms.com> | 2013-07-29 18:59:20 +0200 |
commit | 1d2643cb8153c48dcfdee3d5cda43a38f7e719e2 (patch) | |
tree | c686f81aa28b2aaf6230be66bf058bcc733fdbac /src/cmsio0.c | |
parent | 347ee35613f1cedd676bd066cfa91092144c4173 (diff) | |
download | lcms2-1d2643cb8153c48dcfdee3d5cda43a38f7e719e2.tar.gz |
Fix MemoryWrite bug
Diffstat (limited to 'src/cmsio0.c')
-rw-r--r-- | src/cmsio0.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cmsio0.c b/src/cmsio0.c index 6e3fee1..2430e98 100644 --- a/src/cmsio0.c +++ b/src/cmsio0.c @@ -200,15 +200,14 @@ cmsBool MemoryWrite(struct _cms_io_handler* iohandler, cmsUInt32Number size, con if (ResData == NULL) return FALSE; // Housekeeping // Check for available space. Clip. - if (iohandler ->UsedSpace + size > ResData->Size) { - size = ResData ->Size - iohandler ->UsedSpace; + if (ResData->Pointer + size > ResData->Size) { + size = ResData ->Size - ResData->Pointer; } if (size == 0) return TRUE; // Write zero bytes is ok, but does nothing memmove(ResData ->Block + ResData ->Pointer, Ptr, size); ResData ->Pointer += size; - iohandler->UsedSpace += size; if (ResData ->Pointer > iohandler->UsedSpace) iohandler->UsedSpace = ResData ->Pointer; |