Re: [viewvc-dev] [PATCH} fix inf loop in rcsparse

Linas Vepstas <[email protected]> Fri, 21 Nov 2014 14:50:43 -0600
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <CAHrUA34+dzTuU0umSx9yQRgKoSzwU-xJbdgEYr1-E+fwYQJq1w@mail.gmail.com>
On Fri, Nov 21, 2014 at 2:43 PM, C. Michael Pilato <[email protected]> wrote:
> Haha!  Did you happen to identify what was unique about the problematic
> RCS file?

No. I just assumed that it's size was a multiple of self.CHUNK_SIZE
and somehow got past earlier sections of the code.  There is also some
slim  chance that the repo was subtly corrupted: the first checkin
dates to 1995, so who knows what ancient bug or disk-drive bit-flip
may have found its way in there.

I still have the repo; if you are really curious and have some debug
code, I could run it.

--linas

>
> On 11/21/2014 03:29 PM, Linas Vepstas wrote:
>> Welcome. When my job ran 24 hours, I said to myself 'no way my repo is
>> that big'. :-)
>>
>> On Fri, Nov 21, 2014 at 2:18 PM, C. Michael Pilato <[email protected]> wrote:
>>> On 11/21/2014 01:42 PM, Linas Vepstas wrote:
>>>> I hit an inf loop in rcsparse, presumably due to some particular file
>>>> in my data being 'just so'.  The patch below fixes it: it is simply a
>>>> cut-n-paste of a check made a few dozen lines higher up.   BTW, I
>>>> first tripped over this in cvs2svn, which shares this code with
>>>> viewvc.
>>>>
>>>> --- a/trunk/lib/vclib/ccvs/rcsparse/default.py.orig
>>>> 2014-11-21 12:18:02.880417060 -0600
>>>> +++ b/trunk/lib/vclib/ccvs/rcsparse/default.py
>>>> 2014-11-21 12:26:59.226222392 -0600
>>>> @@ -88,6 +88,10 @@ class _TokenStream:
>>>>
>>>>          # we stopped at the end of the buffer, so we may have a partial
>>>>          # token
>>>>          buf = self.rcsfile.read(self.CHUNK_SIZE)
>>>> +        if buf == '':
>>>> +          # signal EOF by returning None as the token
>>>> +          del self.buf   # so we fail if get() is called again
>>>> +          return None
>>>>          lbuf = len(buf)
>>>>          idx = end = 0
>>> Thanks for the patch.  I've committed it to our trunk, and backported to
>>> the 1.1.x branch, too.
>>>
>
>
> --
> C. Michael Pilato <[email protected]>
> CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development
>

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=3091681

To unsubscribe from this discussion, e-mail: [[email protected]].