Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #41538] readline kills parrot on files missing a final newline

2 views
Skip to first unread message

Joshua Isom

unread,
Feb 19, 2007, 4:49:38 AM2/19/07
to bugs-bi...@rt.perl.org
# New Ticket Created by Joshua Isom
# Please include the string: [perl #41538]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41538 >


If you create a small file, and make sure there is not a newline at the
very
end of the file(I had to use a hex editor), and run this small program
on it,
parrot will just stall and consume cpu and about 20 megs of ram for the
first
while(but does increase). The behavior is the same on freebsd-x86 and
darwin-ppc.

.sub main :main
$P0 = open 'temp.file', '<'
loop:
$S1 = readline $P0
$I0 = length $S1
if $I0 != 0 goto loop
.end

The problem lies in io_buf.c, at line 562. My best guess is that it
doesn't
check that it hasn't gone past the end of the buffer. In some
instances,
parrot segfaults at this location, but it may take a while.

Chromatic

unread,
Feb 20, 2007, 2:36:54 PM2/20/07
to perl6-i...@perl.org
On Monday 19 February 2007 01:49, Joshua Isom wrote:

> The problem lies in io_buf.c, at line 562. My best guess is that it
> doesn't check that it hasn't gone past the end of the buffer. In some
> instances, parrot segfaults at this location, but it may take a while.

Tested in 17079, fixed in r17103.

-- c

0 new messages