bug-global
[Top][All Lists]
Advanced

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

gtags SEGFAULTS on RPi 3 Raspbian (buster)


From: Jim Lowe
Subject: gtags SEGFAULTS on RPi 3 Raspbian (buster)
Date: Tue, 03 Aug 2021 02:02:56 +0000

gtags, (on Raspberry Pi 3 Raspbian buster using the stock gcc) with an 
invocation similar to

                      gtags -i /tmp/xx/  -f /tmp/xxlist.txt

segfaulted on the line in libutil/find.c

                      *--path = ' ';

Does this step to the left of the static array and assign a value?
(and the combination on RaspberryPi 3 and Raspian (buster) does not tolerate 
this).

Other platforms seem not to mind this.

A possible fix is shown in the patch below (this fixed the segfault) and gtags 
seemed to work normally.


--- global-6.6.7/libutil/find.c 2021-07-01 00:06:35.000000000 -0400
+++ global-6.6.7jl/libutil/find.c       2021-07-29 21:42:32.349124964 -0400
@@ -803,45 +803,45 @@
                        continue;
                /*
                 * Skip the following:
                 * o directory
                 * o file which does not exist
                 * o dead symbolic link
                 */
                if (!test("f", path)) {
                        if (test("d", path))
                                warning("'%s' is a directory. ignored.", 
trimpath(path));
                        else
                                warning("'%s' not found. ignored.", 
trimpath(path));
                        continue;
                }
                /*
                 * normalize path name.
                 *
                 *      rootdir  /a/b/
                 *      buf      /a/b/c/d.c -> c/d.c -> ./c/d.c
                 */
-               if (normalize(path, rootdir, cwddir, buf, sizeof(buf)) == NULL) 
{
+               if (normalize(path, rootdir, cwddir, buf+1, sizeof(buf)-1) == 
NULL) {
                        warning("'%s' is out of source tree. ignored.", 
trimpath(path));
                        continue;
                }
-               path = buf;
+               path = buf+1;
                /*
                 * Now GLOBAL can treat the path which includes blanks.
                 * This message is obsoleted.
                 */
                if (!allow_blank && locatestring(path, " ", 
MATCH_LAST)) {
                        warning("'%s' ignored, because it includes blank.", 
trimpath(path));
                        continue;
                }
                if (skipthisfile(path))
                        continue;
                /*
                 * A blank at the head of path means
                 * other than source file.
                 */
                if (!issourcefile(path))
/*SEGFAULT HERE >>>>  */    *--path = ' ';
                return path;
        }
 }



reply via email to

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