BUG: TIFF over 2Gb
Posted: 2008-12-16T04:19:37-07:00
Environment: 32-bit platform, Visual Studio 2008
I have the TIFF file, which is more than 2Gb
ImageMagick could not process this file, because the blob-related (GetBlobSize, SeekBlob etc) functions uses fstat / fseek.
In the structure stat the field st_size has type signed long.
Therefore, we have error with types casting: long -> MagickSizeType (which means unsigned __int64) - sign expansion
The patch could look like this (checked for VS2008)
(compared IM 6.4.7 and trunk)
blob-private.h:
blob.c
I have the TIFF file, which is more than 2Gb
ImageMagick could not process this file, because the blob-related (GetBlobSize, SeekBlob etc) functions uses fstat / fseek.
In the structure stat the field st_size has type signed long.
Therefore, we have error with types casting: long -> MagickSizeType (which means unsigned __int64) - sign expansion
The patch could look like this (checked for VS2008)
(compared IM 6.4.7 and trunk)
blob-private.h:
Code: Select all
4c4
<
---
>
7c7
<
---
>
9c9
<
---
>
63c63
< extern MagickExport const struct __stat64
---
> extern MagickExport const struct stat
Code: Select all
119c119
< struct __stat64
---
> struct stat
1113c1113
< MagickExport const struct __stat64 *GetBlobProperties(const Image *image)
---
> MagickExport const struct stat *GetBlobProperties(const Image *image)
1165c1165
< if (_fstat64(fileno(image->blob->file),&image->blob->properties) == 0)
---
> if (fstat(fileno(image->blob->file),&image->blob->properties) == 0)
1178c1178
< if (_fstat64(fileno(image->blob->file),&image->blob->properties) == 0)
---
> if (fstat(fileno(image->blob->file),&image->blob->properties) == 0)
1186c1186
< if (_fstat64(fileno(image->blob->file),&image->blob->properties) == 0)
---
> if (fstat(fileno(image->blob->file),&image->blob->properties) == 0)
2362c2362
< struct __stat64
---
> struct stat
3277c3277
< if (_fseeki64(image->blob->file,offset,whence) < 0)
---
> if (fseek(image->blob->file,(off_t) offset,whence) < 0)
3619c3619
< offset=_ftelli64(image->blob->file);
---
> offset=ftell(image->blob->file);