delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/01/28/04:16:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 28 Jan 2004 01:16:22 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: perl cygwin weird thing ..
Message-ID: <20040128091622.GA1008@efn.org>
References: <opr2gsy2orsmddlu AT localhost>
Mime-Version: 1.0
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 AT scan-associates DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019