This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [patch] fix memory corruption in libcpp (pr 19077)


On Tue, 2005-02-15 at 11:56 -0800, Zack Weinberg wrote:
> Eric Christopher <echristo@redhat.com> writes:
> 
> > I took a look at this with valgrind after glibc told me that we were
> > corrupting the malloc data structures. After some looking I realized
> > that the length calculation was missing one condition that we used in
> > writing to the array. This fixes the memory corruption problem and the
> > testcase compiles just fine.
> ...
> > +   if (token->flags & PREV_WHITE)
> > +     len++;              /* " " */
> 
> This was supposed to be handled by the 
> 
>           else
>             len += cpp_token_len (token) + 1; /* Includes room for ' '.  */
> 
> a couple lines above.  I see that this neglects to handle
> CPP_MACRO_ARG tokens with preceding whitespace.  So your fix is
> correct, but incomplete.  Would you please take out that +1 and
> comment, and retest?

Sure. Will do.

-eric


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