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

Christian Heimes lists at cheimes.de
Thu Jan 10 16:54:24 CET 2008


Neal Norwitz wrote:
> For traceback.c, namebuf defined on line 155 should be moved out one
> block since filename is an alias to namebuf and it is used outside the
> current scope.  I think this is unlikely to be a problem in practice,
> but is technically wrong and should be fixed.

Agreed, the early allocation of a few hundreds bytes on the stack won't
kill us.

> For codeobject.c, line 327 should not be reachable.  I kinda like the
> code as it is even though it is currently dead.  I never decided if I
> wanted to change that or suppress the warning.

Please suppress the warning. I removed the last two lines and GCC
complained "control reaches end of non-void function". It's not clever
enough to understand that cmp can never be 0.

> For mmapmodule.c, fd should be checked for -1 before calling stat on line 1064.

if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode))

Christian


More information about the Python-Dev mailing list