develooper Front page | perl.perl5.porters | Postings from February 2003

[perl #20798] foo(eval {}) crashes Perl 5.8

Thread Next
From:
Jenda Krynicky
Date:
February 11, 2003 12:42
Subject:
[perl #20798] foo(eval {}) crashes Perl 5.8
Message ID:
rt-20798-50616.13.9176215974562@bugs6.perl.org
# New Ticket Created by  "Jenda Krynicky" 
# Please include the string:  [perl #20798]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20798 >


This is a bug report for perl from Jenda@Krynicky.cz,
generated with the help of perlbug 1.34 running under perl v5.8.0.


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

	sub Foo {exit;}
	print Foo(eval {});

crashes Perl 5.8 (ActiveState build 804) :
	The instruction at "0x7800124c" referenced memory at "0x015e2000".
	The memory could not be "read".

On the other hand

	sub Foo {exit;}
	$v = eval {};
	print Foo($v);

works fine.

I found this while working on my Template::RTF module. The module 
parses RTF templates with things like $[varname], $do[perl code], 
$while[perl code], $print[perl code], ... and translates the template 
into a Perl script (from "Perl inside RTF" creates "RTF inside Perl") 
which it then saves or executes.

In one tests I had $print[] (with no Perl code inside) which got 
translated as:
    ##f_print
    {

    print toRTF(eval {

    });
    report('print',$cmd,$@) if $@;
    }
and it crashed Perl. Of course I can (will) modify the module to 
prevent this.

The code works fine in Perl 5.6.1 built for MSWin32-x86-multi-thread
(ActiveState build 631).

Jenda

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

Configured by ActiveState at Sun Dec  1 23:15:01 2002.

Summary of my perl5 (revision 5 version 8 subversion 0) 
configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define 
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -
D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT -
DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, 
longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, 
Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release  -
libpath:"D:\Perl\lib\CORE"  -machine:x86'
    libpth="C:\Program Files\Microsoft Visual Studio\VC98\Lib" 
"D:\Perl\lib\CORE" "D:\Perl\.cpan\hand_built\gbm-bin-win32"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  
version.lib odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  
version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release  -
libpath:"D:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl v5.8.0:
    D:/Perl/lib
    D:/Perl/site/lib
    .

---
Environment for perl v5.8.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    
PATH=C:\WINNT\system32;C:\WINNT;C:\soft\utils;C:\soft\reskit;D:\Perl\b
in\;C:\WINNT\System32\Wbem;C:\PROGRA~1\PVCS\VM\win32\bin;C:\Program 
Files\Microsoft SQL Server\80\Tools\BINN;D:\Program 
Files\Perforce;C:\Program Files\Common Files\Network 
Associates\VirusScan Engine\4.0.xx\;C:\Program Files\Microsoft Visual 
Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual 
Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual 
Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin
    PERL5OPT=-MG
    PERLDB_OPTS=RemotePort=127.0.0.1:2000
    PERL_BADLANG (unset)
    SHELL (unset)

===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
	-- Terry Pratchett in Sourcery



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