W3C home > Mailing lists > Public > www-amaya@w3.org > July to September 2000

grammar tool bug

From: Fox One <rockman66_1999@yahoo.com>
Date: Sat, 1 Jul 2000 03:02:08 -0700 (PDT)
Message-ID: <20000701100208.18547.qmail@web4304.mail.yahoo.com>
To: www-amaya@w3.org
There is a bug in `Amaya/batch/grammar.c' on
lines 870 and 871. These lines read as follows:

869                  /* cree le fichier .LST */
870                  listFile = fopen (fileName, "w");
871                  fprintf (listFile, "GRAMMAR OF
FILE ");
872                  i = 0;
873                  while (fileName[i] != '.')
874                    putc (fileName[i++], listFile);

The return value from `fopen()' is not checked
for failure. If the user doesn't have permission
to write the to list file, `fopen()' will fail
(returning null).

On my system (LINUX-ELF), the call to `fprintf()'
on line 871 doesn't produce a segfault for some
reason, but the segfault does occur on line 874 --
when `putc()' is called.

The return values for `fopen' and `malloc' should
*always* be checked for possible failure.

I discovered this problem when trying to compile
Amaya as a different user from the user that
checked out the working directory.

Another (related) problem, is that, even if you
build Amaya in a directory that is different from the
working directory, the build process wants to write
into the working directory anyway.



__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/
Received on Saturday, 1 July 2000 06:02:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 20 September 2007 14:24:27 GMT