bug-cvs
[Top][All Lists]
Advanced

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

RE: Memory error when using user variables in loginfo


From: Jeremy Bopp
Subject: RE: Memory error when using user variables in loginfo
Date: Thu, 9 Dec 2004 09:15:45 -0600

Looks like my attachment was stripped.  Sorry if I'm mistaken, but here
it is inline:

------- Patch begins -------

diff -r -c cvs-1.12.10/src/expand_path.c
cvs-1.12.10.new/src/expand_path.c
*** cvs-1.12.10/src/expand_path.c       2004-11-04 09:15:27.000000000
-0600
--- cvs-1.12.10.new/src/expand_path.c   2004-12-04 16:42:31.000000000
-0600
***************
*** 157,169 ****
        }
        else if (*s++ == '$')
        {
!           char *p = d;
            char *e;
            int flag = (*s == '{');
  
            doff = d - mybuf;
            expand_string (&mybuf, &mybuf_size, doff + 1);
            d = mybuf + doff;
            for (; (*d++ = *s); s++)
            {
                if (flag
--- 157,172 ----
        }
        else if (*s++ == '$')
        {
!           char *p;
!           size_t poff;
            char *e;
            int flag = (*s == '{');
  
+           poff = d - mybuf;
            doff = d - mybuf;
            expand_string (&mybuf, &mybuf_size, doff + 1);
            d = mybuf + doff;
+           p = mybuf + poff;
            for (; (*d++ = *s); s++)
            {
                if (flag
***************
*** 173,178 ****
--- 176,182 ----
                doff = d - mybuf;
                expand_string (&mybuf, &mybuf_size, doff + 1);
                d = mybuf + doff;
+               p = mybuf + poff;
            }
            *--d = '\0';
            e = expand_variable (&p[flag], file, line);
***************
*** 182,192 ****
--- 186,198 ----
                doff = d - mybuf;
                expand_string (&mybuf, &mybuf_size, doff + 1);
                d = mybuf + doff;
+               p = mybuf + poff;
                for (d = &p[-1]; (*d++ = *e++);)
                {
                    doff = d - mybuf;
                    expand_string (&mybuf, &mybuf_size, doff + 1);
                    d = mybuf + doff;
+                   p = mybuf + poff;
                    if (d[-1] == '"')
                    {
                        /* escape the double quotes if we're between a
matched
***************
*** 200,205 ****
--- 206,212 ----
                            doff = d - mybuf;
                            expand_string (&mybuf, &mybuf_size, doff +
1);
                            d = mybuf + doff;
+                           p = mybuf + poff;
                            *d++ = '"';
                        }
                    }
***************
*** 211,216 ****
--- 218,224 ----
                        doff = d - mybuf;
                        expand_string (&mybuf, &mybuf_size, doff + 1);
                        d = mybuf + doff;
+                       p = mybuf + poff;
                        *d = d[-1];
                        d++;
                    }

------- Patch ends   -------

> -----Original Message-----
> From: bug-cvs-bounces+jeremy=motive.com@gnu.org 
> [mailto:bug-cvs-bounces+jeremy=motive.com@gnu.org] On Behalf 
> Of Jeremy Bopp
> Sent: Wednesday, December 08, 2004 5:35 PM
> To: bug-cvs@gnu.org
> Subject: Memory error when using user variables in loginfo
> 
> 
> Hello, all.  I'm new to the list, so I hope this is the proper forum.
> 
> My company has a tool that makes use of a large number of 
> user variables
> in the hook files, and we seem to have tickled a bug.  You can pretty
> reliably recreate the problem by referencing user variables in some
> loginfo hooks.  Set and reference 6 variables with about 8 to 12
> characters in each name and values that range in length from 5 to 10
> characters.  Then commit some code that will trigger the 
> loginfo entry.
> You should see some error messages saying that some user 
> variable could
> not be located.  That variable may have some of one of your variable
> names in it along with some garbage.
> 
> Attached is a patch that fixes the handling of a memory 
> pointer that is
> never updated after the array it points into is reallocated.  This
> should apply cleanly to a 1.12.10 source tree using patch -p1 when
> inside the tree.  My tests after using the patch indicated 
> that the bug
> was fixed, and I didn't notice any new ones crop up.
> 
> If a different patch format is required or if there are questions,
> please contact me.
> 
> -Jeremy
> 
> ------------------
> Jeremy Bopp
> Software Developer
> Motive Inc.
> jeremy@motive.com
> ------------------ 
> 




reply via email to

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