develooper Front page | perl.perl5.porters | Postings from October 2000

[ID 20001031.004] Uninitialized auto variable in regcomp.c

Thread Next
From:
Martin Husemann
Date:
October 31, 2000 14:40
Subject:
[ID 20001031.004] Uninitialized auto variable in regcomp.c
Message ID:
200010312239.e9VMdZR01580@night-porter.duskware.de
This is a bug report for perl from martin@duskware.de,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
 [Please enter your report here]

When trying to get perl (5.6.0 for now, but checked 5.7.0 has the 
same problem) running on my NetBSD/sparc64 (Ultra5) system, I
found a glitch in regcomp.c. When miniperl is run to autosplit
libraries (before Dynaloader and *.so's are created) it failed
for me (repeatable, fortunately) when trying to malloc memory
in the gigabyte range. I tracked this down to the use of
pos_before without being initialized. I don't know if this is
because of some other (yet undiscovered) bug, but at least
it's not obvious when looking at the code that it is used 
in a save way.

This patch fixes it (and, together with a hints file, makes perl
build for me on NetBSD/sparc64):

--- regcomp.c.orig	Tue Aug 22 16:30:00 2000
+++ regcomp.c	Tue Oct 31 23:20:14 2000
@@ -841,12 +841,12 @@
 		cl_and(data->start_class, &and_with);
 	    }
 	    flags &= ~SCF_DO_STCLASS;
 	}
 	else if (strchr((char*)PL_varies,OP(scan))) {
-	    I32 mincount, maxcount, minnext, deltanext, pos_before, fl;
-	    I32 f = flags;
+	    I32 mincount, maxcount, minnext, deltanext, fl;
+	    I32 f = flags, pos_before = 0;
 	    regnode *oscan = scan;
 	    struct regnode_charclass_class this_class;
 	    struct regnode_charclass_class *oclass = NULL;
 
 	    switch (PL_regkind[(U8)OP(scan)]) {


 [Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=critical
---
Site configuration information for perl v5.6.0:

Configured by martin at Sat Sep  2 11:08:51 MEST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=netbsd, osvers=1.5e, archname=i386-netbsd
    uname='netbsd night-porter.duskware.de 1.5e netbsd 1.5e (porter) #0: fri sep 1 07:26:22 mest 2000 martin@night-porter.duskware.de:usrsrcsys-i4barchi386compileporter i386 '
    config_args='-sde -Dprefix=/usr/pkg -Doptimize=-O2 -march=i686 -mfancy-math-387 -pipe -Darchname=i386-netbsd -Dcc=gcc -Dusemymalloc=false -Duseshrplib=true'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O2 -march=i686 -mfancy-math-387 -pipe', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    cppflags='-fno-strict-aliasing -I/usr/pkg/include'
    ccflags ='-fno-strict-aliasing -I/usr/pkg/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/pkg/lib'
    libpth=/usr/pkg/lib /usr/lib
    libs=-lm -lcrypt
    libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-R/usr/pkg/lib  -Wl,-R/usr/pkg/lib/perl5/5.6.0/i386-netbsd/CORE'
    cccdlflags='-DPIC -fPIC ', lddlflags='--whole-archive -shared  -L/usr/pkg/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /usr/pkg/lib/perl5/5.6.0/i386-netbsd
    /usr/pkg/lib/perl5/5.6.0
    /usr/pkg/lib/perl5/site_perl/5.6.0/i386-netbsd
    /usr/pkg/lib/perl5/site_perl/5.6.0
    /usr/pkg/lib/perl5/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/martin
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=iso-8859-1
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/sbin:/usr/sbin:/bin:/usr/local/bin:/usr/bin:/usr/pkg/bin:/usr/pkg/sbin:/home/martin/bin:/usr/games:/usr/X11R6/bin:/usr/X11R6/motif-1.2.1/bin
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh



Thread Next


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