develooper Front page | perl.perl5.porters | Postings from April 2012

[perl #112608] panic: sv_setpvn called with negative strlen -1

Thread Next
From:
Steve Hay
Date:
April 25, 2012 02:22
Subject:
[perl #112608] panic: sv_setpvn called with negative strlen -1
Message ID:
rt-3.6.HEAD-4610-1335344090-145.112608-75-0@perl.org
# New Ticket Created by  "Steve Hay" 
# Please include the string:  [perl #112608]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=112608 >


This is a bug report for perl from Steve.Hay@verosoftware.com,
generated with the help of perlbug 1.39 running under perl 5.15.9.


-----------------------------------------------------------------
[Please describe your issue here]

Running the program below with the attached utf8.txt input file produces
the following crash:
panic: sv_setpvn called with negative strlen -1 at utf8.pl line 4, <$rh>
line 28.
Close with partial character at utf8.pl line 4, <$rh> line 28.

open my $rh, '<:encoding(UTF-8)', 'utf8.txt' or die $!;
open my $wh, '>:encoding(ISO-8859-1)', 'iso88591.txt' or die $!;
#select((select($wh), $| = 1)[0]);
print $wh $_ while <$rh>;
close $wh;
close $rh;

Obviously the (Greek) characters in the input file cannot be converted
to ISO-8859-1, but perl shouldn't crash.
Uncommenting the select() call strangely makes the crash go away. So
does deleting any single line from the input file.

The crash isn't new. I got the same result with 5.8.9.

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

Configured by shay at Wed Apr 25 08:54:19 2012.

Summary of my perl5 (revision 5 version 15 subversion 9) configuration:
  Commit id: 906024c7fead4086ed911b8052d784aa07c2f1e2
  Platform:
    osname=MSWin32, osvers=6.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=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 -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE  -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='16.00.40219.01', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    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 -debug -opt:ref,icf
-libpath:"c:\perl\lib\CORE"  -machine:x86
"/manifestdependency:type='Win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df'
language='*'"'
    libpth=\lib
    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 ws2_32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib comctl32.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 ws2_32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl515.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"c:\perl\lib\CORE"  -machine:x86
"/manifestdependency:type='Win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df'
language='*'"'

Locally applied patches:
    

---
@INC for perl 5.15.9:
    C:/perl/site/lib
    C:/perl/lib
    .

---
Environment for perl 5.15.9:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\
System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL
Server\100\DTS\Binn\;C:\Program Files (x86)\Common Files\Roxio
Shared\OEM\12.0\DLLShared;C:\Program Files (x86)\Microsoft Team
Foundation Server 2010 Power Tools\;C:\Program Files (x86)\Microsoft
Team Foundation Server 2010 Power Tools\Best Practices
Analyzer\;C:\perl\bin
    PERL_BADLANG (unset)
    SHELL (unset)


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