Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 28 Jan 2004 01:16:22 -0800
From: Yitzchak Scott-Thoennes <sthoenna@efn.org>
To: cygwin@cygwin.com
Subject: Re: perl cygwin weird thing ..
Message-ID: <20040128091622.GA1008@efn.org>
References: <opr2gsy2orsmddlu@localhost>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <opr2gsy2orsmddlu@localhost>
User-Agent: Mutt/1.4i
Organization: bs"d
X-IsSubscribed: yes

On Wed, Jan 28, 2004 at 10:53:16AM +0800, pokley <pokleyzz@scan-associates.net> wrote:
> im using latest cygwin 1.5.6 on windows 2000 server ia32.
> doing
> $ perl -e 'print "a" x 0xffffffff' will display weird result
> 
> perl will core dump when parsing file contain
> printf "%s",'a' x 0xffffffff;
> 
> does anybody got the same problem ?

This is a bug in perl.  It's taking the (size_t) length of the string
(1) times the (long long) repeat count (2**32-1), adding 1, and
casting it to a size_t, resulting in 0, thus bypassing realloc'ing the
string buffer for the result of the x.  Then it gleefully tromps all
over other things in memory.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

