[Python-Dev] Coverity Scan, Python upgraded to rung 2

A.M. Kuchling amk at amk.ca
Thu Jan 10 14:38:15 CET 2008


On Wed, Jan 09, 2008 at 09:11:21PM -0800, Neal Norwitz wrote:
> For mmapmodule.c, fd should be checked for -1 before calling stat on line 1064.

On looking at this, it doesn't seem like an actual problem.  fstat(-1,
...) returns a -1 and errno is set to EBADF, 'bad file descriptor'.

	/* on OpenVMS we must ensure that all bytes are written to the file */
        fsync(fd);
#  endif
	if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
	     ...

In rev. 59888, I've added 'fd != -1' to the 'if' just to save a
pointless fstat() call, and made the OpenVMS fsync() call similarly
conditional, but I don't think this item is a bug, much less a
security bug.  I won't bother backporting this to 25-maint, unless
asked to do so by the 2.5 maintainer.

--amk


More information about the Python-Dev mailing list