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

[ID 20000919.002] Infinite Loop In Regexp Machinery

Thread Next
Karl Dahlke
September 19, 2000 16:33
[ID 20000919.002] Infinite Loop In Regexp Machinery
Message ID:
The following perl program hangs when it evaluates the regexp.

#  Sample html text from
#  Note that a quote is missing, which really throws things off.
#  Still, it shouldn't cause the regexp machinery to hang.
$buffer = '
<IMG  SRC="headlines/images/harvestmoon/frontpage.gif" ALIGN="RIGHT"
    hspace="4 width=" 120" HEIGHT="99" BORDER="2" WIDTH="120" NATURALSIZEFLAG="1"></A>';

#  Break the text up into html tags.
print "Pre regexp\n";
$buffer =~ s/<  # start the tag
(\/?)  # leading slash turns off the tag
([a-zA-Z]+)  # name of the tag
(([^>"']+  # unquoted stuff inside the tag
|"[^"]*"  # stuff in double quotes
|'[^']*'  # stuff in single quotes
)*)>  # as many of these chunks as you need

print "Post regexp\n";  # never gets here


perl -V

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=linux, osvers=2.2.5-4, archname=i386-linux
    uname='linux vador 2.2.5-4 #1 tue apr 6 19:46:00 edt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    cc='cc', optimize='-O2', gccversion=pgcc-2.91.60 19981201 (egcs-1.1.1 release)
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/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
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Apr 13 1999 04:06:24

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About