AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1998.11.24 07:10 "Bug in tif_unix.c", by Terry Wells
1998.11.24 07:14 "Re: Bug in tif_unix.c", by Bjorn Brox
1998.11.24 18:31 "Re: Bug in tif_unix.c", by Sam Leffler
1998.11.24 19:11 "Re: Bug in tif_unix.c", by Rex Jolliff

1998.11.24 07:14 "Re: Bug in tif_unix.c", by Bjorn Brox

I just noticed a bug in tif_unix.c (and perhaps tif_win32.c, but I'm not sure)

Catch is, I don't know if it's worth fixing or not...

The Problem:

In the function _tiffMapProc, the function _tiffSizeProc is used to get the size of the file. This size is then compared with -1 to check for an error.

The problem is that _tiffSizeProc always returns a value >= 0. Thus size will never be -1 and _tiffMapProc will always attempt to map the file.

Yes, this is an error present in tif_unix.c, tif_msdos.c, tif_vms.c and tif_win3.c

The _tiffSizeProc() function should return -1 when the file id is attached to a terminal or similar. In such cases _tiffMapProc() would also fail so not fixing the error would not cause any fatal errors.

Fixing it?
Sam?

--
Bjorn Brox, CORENA Norge AS, http://www.corena.no/
Kirkegaardsvn. 45, P.O.Box 1024, N-3601 Kongsberg, NORWAY
Phone: +47 32737435, Fax: +47 32736877, Mobile: +47 92638590