develooper Front page | perl.perl5.porters | Postings from March 2004

Re: [perl #27392] 5.8.2 cores or loops using hashref as subscript

From:
Tim Bunce
Date:
March 5, 2004 03:52
Subject:
Re: [perl #27392] 5.8.2 cores or loops using hashref as subscript
Message ID:
20040305115327.GB75324@dansat.data-plan.com
On Thu, Mar 04, 2004 at 06:15:02PM -0000, Kenneth Lorber wrote:
> HPUX 11:
> 	X: 1
> 	X: HASH(0x4001ecc8)
> 	Segmentation fault (core dumped)
> 
> gdb says:
> #0  0x00058948 in Perl_av_extend (av=0x4001208c, key=1073840232) at av.c:158
> 158                         ary[--tmp] = &PL_sv_undef;

The bug is that the failed memory allocation for 1073840232*sizeof(SV*)
wasn't detected.

> 5.6.1 on the same HPUX box does the same.
> 
> Under Mac OS X 10.2.8, 5.8.2 it doesn't core.  Instead it prints:
> 	X: 1
> 	X: HASH(0x28b224)
> 	X:
> (the last line repeated 7 million times before I killed it).
> 
> 5.6.0 (the official apple binary) also goes into a loop.

0x28b224 is a lot smaller than 0x4001ecc8. The memory allocation worked
and it's printing millions of undefs.

Tim.

> Sample code:
> 
> $G->{A}{B}[0] = 1;
> # what I meant:
> #       foreach (0..$#{$G->{A}{B}} ){
> # what I wrote, causes core or loop:
> 	foreach (@{$G->{A}{B}} ){
> 		print "X: $_\n";
> 		$G->{A}{B}[$_]{C};
> 	}
> 
> [Please do not change anything below this line]
> -----------------------------------------------------------------
> ---
> Flags:
>     category=core
>     severity=low
> ---
> Site configuration information for perl v5.8.2:
> 
> Configured by tsadm at Fri Feb 13 13:59:59 EST 2004.
> 
> Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
>   Platform:
>     osname=hpux, osvers=11.00, archname=PA-RISC2.0
>     uname='hp-ux tsdev-m1 b.11.00 a 9000800 633329363 two-user license '
>     config_args='-Dprefix=/stats/process2/stats_share -Dcc=/usr/cygnus/bin/gcc -DPERL_POLLUTE_MALLOC'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
>     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=undef use64bitall=undef uselongdouble=undef
>     usemymalloc=y, bincompat5005=undef
>   Compiler:
>     cc='/usr/cygnus/bin/gcc', ccflags ='-D_HPUX_SOURCE -DUINT32_MAX_BROKEN -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
>     optimize='-g -O',
>     cppflags='-D__STDC_EXT__ -D_HPUX_SOURCE -D_HPUX_SOURCE -DUINT32_MAX_BROKEN -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
>     ccversion='', gccversion='2.9-gnupro-98r2', gccosandvers='hpux11.00'
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
>     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
>     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
>     alignbytes=8, prototype=define
>   Linker and Libraries:
>     ld='/usr/bin/ld', ldflags =' -Wl,+vnocompatwarnings -L/usr/local/lib'
>     libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
>     libs=-lnsl -lnm -lndbm -lgdbm -ldb -ldld -lm -lcrypt -lsec -lc
>     perllibs=-lnsl -lnm -ldld -lm -lcrypt -lsec -lc
>     libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
>     gnulibc_version=''
>   Dynamic Linking:
>     dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
>     cccdlflags='-fPIC', lddlflags='-b -L/usr/local/lib'
> 
> Locally applied patches:
>     
> 
> ---
> @INC for perl v5.8.2:
>     /stats/process2/stats_share/lib/perl5/5.8.2/PA-RISC2.0
>     /stats/process2/stats_share/lib/perl5/5.8.2
>     /stats/process2/stats_share/lib/perl5/site_perl/5.8.2/PA-RISC2.0
>     /stats/process2/stats_share/lib/perl5/site_perl/5.8.2
>     /stats/process2/stats_share/lib/perl5/site_perl
>     .
> 
> ---
> Environment for perl v5.8.2:
>     HOME=/home/keni
>     LANG (unset)
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
>     PATH=.share/bin:/opt/perl5/bin:/home/keni/bin:/cm/bin/cvs/bin:/usr/cygnus/bin:/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/fc/bin:/opt/fcms/bin:/opt/upgrade/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/hparray/bin:/opt/resmon/bin:/opt/pred/bin:/opt/perf/bin:/opt/OV/bin/OpC:/opt/cxperf/bin:/opt/langtools/bin:/opt/imake/bin:/opt/graphics/common/bin:/usr/sbin/diag/contrib:/opt/aCC/bin:/usr/local/bin
>     PERL_BADLANG (unset)
>     SHELL=/usr/bin/csh



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About