This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4101] New: "depth" logic in argp/argp-help.c:hol_cluster_cmp is broken


The comparisons at the start of hol_cluster_cmp goes the wrong way. This makes
foo --help crash when foo has a sufficiently complicated argp tree such that
some clusters are of different depth.

Unfortunately, the only test case I have handy is the development version of lsh.

Tested version: 2.3.2.ds1-22sarge5, but this part of argp seems to ve unchanged
for a very long time.

patch:

--- argp-help.c 2 Mar 2004 21:15:22 -0000       1.23
+++ argp-help.c 26 Feb 2007 17:50:38 -0000      1.24
@@ -690,9 +690,9 @@ hol_cluster_cmp (const struct hol_cluste
 {
   /* If one cluster is deeper than the other, use its ancestor at the same
      level, so that finding the common ancestor is straightforward.  */
-  while (cl1->depth < cl2->depth)
+  while (cl1->depth > cl2->depth)
     cl1 = cl1->parent;
-  while (cl2->depth < cl1->depth)
+  while (cl2->depth > cl1->depth)
     cl2 = cl2->parent;
 
   /* Now reduce both clusters to their ancestors at the point where both have

-- 
           Summary: "depth" logic in argp/argp-help.c:hol_cluster_cmp is
                    broken
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nisse at lysator dot liu dot se
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: any
  GCC host triplet: any
GCC target triplet: any


http://sourceware.org/bugzilla/show_bug.cgi?id=4101

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]