This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: perl cygwin weird thing ..
- From: Yitzchak Scott-Thoennes <sthoenna at efn dot org>
- To: cygwin at cygwin dot com
- Date: Wed, 28 Jan 2004 01:16:22 -0800
- Subject: Re: perl cygwin weird thing ..
- Organization: bs"d
- References: <opr2gsy2orsmddlu@localhost>
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/