bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] One bug, one possible bug and some small speed improvements


From: Simon D.
Subject: [BUG] One bug, one possible bug and some small speed improvements
Date: Sat, 14 Mar 2015 10:05:11 +0000

Hi.
One bug, one possible bug and some small speed improvements.

(in GNU Global 6.3.4 source).

The bug is in getconfs() [conf.c] parameter sb is not tested in all the places
it is used, against NULL.
I added the following temporary test code after 'if (!exist) {', line 392:

        if(sb == NULL)
                die("sb == NULL in getconfs()");

and it kept dying [die()ing] and displaying that message.

The possible bug is in setupdbpath() [getdbpath.c], the return value from the 
call
to 's = strbuf_fgets(sb, fp, STRBUF_NOCRLF);' on line 306 could be NULL, and 
the next
function called is 'if (!test("d", s)) {', test() would use the previous 
pathname used,
which would be the wrong one or it would die(); if the file was empty, but not 
sure
if this is possible.

The speed improvements are:
 1. Removal of duplicate uses of strlen() in assoc.c and dbop.c
 2. A change to use strbuf_getlen() instead of strlen() in makepath() 
[makepath.c]
 3. A moved strlen() in getconfs() [conf.c] as the string it uses doesn't change
     in the loop.

I have also added some additions to the Doxygen comments.

Simon Dommett



Attachment: diffs_patch.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]