2022.04.18 15:08 "[Tiff] FW: File Offset Truncation due to incorrectr data typing for Return Argument in TIFF_WriteOverview", by Mike Stanton

2022.04.18 16:18 "Re: [Tiff] FW: File Offset Truncation due to incorrectr data typing for Return Argument in TIFF_WriteOverview", by Bob Friesenhahn

For my work I am dealing with a very large mosaic TIFF of 1.5TB. It is my intent to take that large file and carve it up into 256X256 tiles for WMS. While doing my build of the Tiff Library for 4.3.0 I fount a number of warnings of possible data loss cases because of truncation of Variables, specifically File offsets. I realize the diagnostic can be ignored but doing so may lead to data corruption or loss of content. So I started going through the code and the very first one was a Warning C4244 message

The returned parameter is of a uint64_t data type but the function declaration and definitions are both done with a uint32_t Value. Attached are screenshots of the various definitions and usages taken from a Visual Studio code inspection in which I was engaging because of the alarming number of Warning messages of this type that I was seeing. Most of them are innocuous but some could result in data loss when using large files.

Your screen shots were removed by the mailing list implementation. Maybe you have a web site somewhere where you an post it and then share the URL to it?

What version of Visual Studio are you using? What means did you use to create the project files?

What I/O model are you using? There is a choice of tif_win32.c and tif_unix.c.

As you compiling as a 32 bit or 64 bit application?

I am willing to make the necessary changes to correct all the C4244 Warnings and other related changes to get a clean compile if nobody else has done so because another project I was on formy former employer taught me that leaving these warnings in place without following proper typecasting protocols when changing radix scales yields unpredictable errors. Please advise. Am I missing something? Am I on a fool's Errand?

If it was just me, I would try to fix/quiet the Visual Studio warnings but others on the project do not agree with this since requires adding many type casts to the code and the type casts might hide a problem. They prefer to fix only issues which are bugs.

Microsoft Windows is strange since in 64-bit builds, the size of 'long' is still only 32 bits. Interfaces defined in terms of 'long' can cause problems.

Bob

Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt