chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] Fix for read-line overflow


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Fix for read-line overflow
Date: Sat, 16 Feb 2013 14:06:39 +0100
User-agent: Mutt/1.4.2.3i

Hi all,

Yesterday's salmonella run went all wrong, and Mario figured out that this
was due to my read-line patch messing with chicken-install.

It turns out that the condition in ##sys#scan-buffer-line which reads
(and (eq? c #\return)   ; \r\n -> drop \r from string
     (fx> limit (fx+ pos 1))
     (eq? (##core#inline "C_subchar" buf (fx+ pos 1)) #\newline))
gets confused.  This is because when the user does not supply a "limit"
argument to read-line, it's set to (##sys#fudge 21), which is equal to
most-positive-fixnum.  However, later the buffer offset index is
added to it, which causes an overflow.

This patch simply subtracts the index from most-positive-fixnum to make
room for it to be added later.  It's a little messy, but I don't see a
clean way to improve it immediately.

Cheers,
Peter
-- 
http://www.more-magic.net

Attachment: 0001-Get-rid-of-overflow-situation-in-read-line-causing-l.patch
Description: Text document


reply via email to

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