bug-global
[Top][All Lists]
Advanced

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

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


From: Shigio YAMAGUCHI
Subject: Re: [BUG] One bug, one possible bug and some small speed improvements
Date: Mon, 16 Mar 2015 11:26:32 +0900

Hi,
I have committed it.
About the following, I have added a test for each place.

> The bug is in getconfs() [conf.c] parameter sb is not tested in all the places
> it is used, against NULL.

I thought that I should write better code.
Thank you always.

Regards,
Shigio


2015-03-14 19:05 GMT+09:00 Simon D. <address@hidden>:

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




_______________________________________________
Bug-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-global




--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

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