bug-coreutils
[Top][All Lists]
Advanced

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

Re: Fix misalignment


From: Jim Meyering
Subject: Re: Fix misalignment
Date: Mon, 23 Jul 2007 16:22:38 +0200

Andreas Schwab <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>> Andreas Schwab <address@hidden> wrote:
>>> 2007-07-23  Andreas Schwab  <address@hidden>
>>>
>>>     * src/sort.c (fillbuf): Make sure the buffer limit is always
>>>     aligned after the buffer was grown.
>>>
>>> diff --git a/src/sort.c b/src/sort.c
>>> index 824dd0d..6024be7 100644
>>> --- a/src/sort.c
>>> +++ b/src/sort.c
>>> @@ -1492,6 +1492,8 @@ fillbuf (struct buffer *buf, FILE *fp, char const 
>>> *file)
>>>        /* The current input line is too long to fit in the buffer.
>>>      Double the buffer size and try again.  */
>>>        buf->buf = X2REALLOC (buf->buf, &buf->alloc);
>>> +      /* Realign buffer limit.  */
>>> +      buf->alloc -= buf->alloc % sizeof (struct line);
>>>      }
>>>  }
>>
>> Thanks!
>> Can you provide a test case to exercise that code?
>
> Obviously you need a file with a long line.

Thanks, but I knew that :-)
I even tried something simple, like this

  perl -e 'print "a"x99383420' |./sort > /dev/null

but that didn't trigger it.
I spent a couple more minutes and triggered the code with this:

  perl -e 'print "a"x1015' |./sort -S 1 > /dev/null

Can you make the unpatched sort misbehave?

I.e., how did you discover the bug?




reply via email to

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