Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 To: cygwin AT cygwin DOT com Subject: Re: perl cygwin weird thing .. Message-ID: <20040128091622.GA1008@efn.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Organization: bs"d X-IsSubscribed: yes On Wed, Jan 28, 2004 at 10:53:16AM +0800, pokley 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/