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

[perl #108896] Fix bad pointer size in has_trailing_nul

Thread Next
From:
Eric Brine
Date:
January 23, 2012 19:01
Subject:
[perl #108896] Fix bad pointer size in has_trailing_nul
Message ID:
rt-3.6.HEAD-14510-1327374054-68.108896-75-0@perl.org
# New Ticket Created by  "Eric Brine" 
# Please include the string:  [perl #108896]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=108896 >


This is a bug report for perl from ikegami@adaelis.com,
generated with the help of perlbug 1.39 running under perl 5.14.0.


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

On Mon, Jan 23, 2012 at 3:14 PM, Eric Brine <ikegami@adaelis.com> wrote:

> On Mon, Jan 23, 2012 at 10:45 AM, Karl Williamson <public@khwilliamson.com
> > wrote:
>
>> I'm getting this lately, and also note that the smokes aren't showing it.
>>
>> ...
>>
>> ok 76 - seeking on a glob copy from the end
>> Use of uninitialized value $pv_addr in addition (+) at
>> ../ext/PerlIO-scalar/t/scalar.t line 332.
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> __memmove_ssse3 () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S:1410
>> 1410    ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S: No such file or
>> directory.
>>        in ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S
>>
>>
>> It sounds like my system might be defective
>>
>
> If $pv_addr is treated as zero (as indicated by the warning), a segfault
> is expected. This isn't a problem with memcpy.
>
>  331    my $pv_addr = unpack 'J', pack 'P', $$ref;
>  332    my $trailing = unpack 'P', pack 'J', $pv_addr+$cur;
>

$pv_addr is undef because C<< unpack 'J' >> is returning undef because C<<
pack 'P' >> returns something smaller than a UV.

"J" is not always correct.
If PTRSIZE == INTSIZE, "I" should be used.
If PTRSIZE != INTSIZE, "J" should be used.
(See DO_BO_PACK_PC and DO_BO_UNPACK_PC in pp_pack.c)

Patch attached.

- Eric

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=high
    module=PerlIO::scalar
---
Site configuration information for perl 5.14.0:

Configured by gecko at Thu May 12 09:33:39 2011.

Summary of my perl5 (revision 5 version 14 subversion 0) configuration:

  Platform:
    osname=MSWin32, osvers=5.2, 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='C:/Progs/PERL51~4/site/bin/gcc.exe', ccflags ='-DNDEBUG -DWIN32
-D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-D_USE_32BIT_TIME_T -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields',
    optimize='-O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='3.4.5 (mingw-vista special r3)',
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='C:\Progs\PERL51~4\site\bin\g++.exe', ldflags
='-L"C:\Progs\perl5140-ap1400\lib\CORE"'
    libpth=\lib
    libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm
-lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt
    perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm
-lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl514.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -L"C:\Progs\perl5140-ap1400\lib\CORE"'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl 5.14.0:
    C:/Progs/perl5140-ap1400/site/lib
    C:/Progs/perl5140-ap1400/lib
    .

---
Environment for perl 5.14.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;c:\bin;C:\Progs\perl5140-ap1400\site\bin;C:\Progs\perl5140-ap1400\bin;C:\Program
Files
(x86)\UltraEdit;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files
(x86)\Common Files\Microsoft Shared\Windows Live;C:\Program
Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth
Software\syswow64;C:\Program Files (x86)\Common Files\Ulead
Systems\MPEG;C:\Program Files\Microsoft Windows Performance
Toolkit\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files
(x86)\QuickTime\QTSystem\
    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