Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#265 sever on Empty piddle causes segfault

critical
closed-fixed
core (120)
9
2011-09-17
2011-04-29
Derek Lamb
No

On my Mac and also on a Linux system, with the current git (2.4.9_001), calling sever on an empty piddle results in a segfault:

pdl> $img = zeroes(100,100)
pdl> $coords = which($img!=0)
pdl> $vals = $img->indexND($coords)->sever;
Segmentation fault

I do not get the error when running PDL 2.4.7 or 2.4.8 (in those cases the null piddle is returned). I also do not get a segfault when I do not include the sever(). Without the sever, $img->indexND($coords) is PDL->null (when doing pdl>?vars). But for reasons I don't understand, I don't get the segfault if I try to trip the error more directly:

pdl> $a = PDL->null
pdl> $b = $a->sever;
pdl> $c = PDL->null->sever
pdl>

Discussion

1 2 > >> (Page 1 of 2)
  • Chris Marshall
    Chris Marshall
    2011-04-29

    I don't get the same problem on cygwin but that is not OS X
    or a 64bit OS (you don't include the perldl -V or perl -V output
    so I'm guessing here).

    I can point out that the problem is for Empty piddles and
    not Null piddles. Those were added/fixed for more edge
    cases with the recent fixes to the PDL constructor. It is possible
    that this is a symptom of the same problem relating to the
    other OS X segfaults being reported. What do you get when
    you look at the core with gdb?

     
  • Chris Marshall
    Chris Marshall
    2011-04-29

    • labels: 101697 --> core
     
  • Chris Marshall
    Chris Marshall
    2011-04-29

    I do get the problem with an ActiveState install of PDL-2.4.9:

    asperl> perldl -V
    perlDL shell v1.354
    PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
    'COPYING' in the PDL distribution. This is free software and you
    are welcome to redistribute it under certain conditions, see
    the same file for details.
    Set up gcc environment - 3.4.5 (mingw-vista special r3)

    Summary of my PDL configuration

    VERSION: PDL v2.4.9 (supports bad values)

    $%PDL::Config = {
    'BADVAL_PER_PDL' => '0',
    'WITH_PROJ' => '1',
    'FFTW_TYPE' => 'double',
    'FFTW_LIBS' => [
    'C:/_32/msys/1.0/local/lib'
    ],
    'WITH_FFTW' => '1',
    'GSL_LIBS' => undef,
    'GL_BUILD' => '1',
    'WITH_IO_BROWSER' => '0',
    'PROJ_INC' => [
    'C:/_32/msys/1.0/local/include'
    ],
    'WHERE_PLPLOT_INCLUDE' => 'C:/_32/msys/1.0/local/include/plplot',
    'HTML_DOCS' => '1',
    'SKIP_KNOWN_PROBLEMS' => '1',
    'WHERE_PLPLOT_LIBS' => 'C:/_32/msys/1.0/local/lib',
    'WITH_3D' => '1',
    'WITH_POSIX_THREADS' => '0',
    'POGL_VERSION' => '0.63',
    'FFTW_INC' => [
    'C:/_32/msys/1.0/local/include'
    ],
    'HIDE_TRYLINK' => '1',
    'WITH_HDF' => '0',
    'HDF_INC' => undef,
    'POGL_WINDOW_TYPE' => 'glut',
    'WITH_BADVAL' => '1',
    'WITH_GD' => '1',
    'FITS_LEGACY' => '1',
    'WITH_SLATEC' => '1',
    'BADVAL_USENAN' => '0',
    'WITH_DEVEL_REPL' => '1',
    'TEMPDIR' => 'C:\\Local\\Temp',
    'PROJ_LIBS' => [
    'C:/_32/msys/1.0/local/lib'
    ],
    'USE_POGL' => '1',
    'GD_LIBS' => [
    'C:/_32/msys/1.0/local/lib'
    ],
    'GSL_INC' => undef,
    'GD_INC' => [
    'C:/_32/msys/1.0/local/include'
    ],
    'WITH_GSL' => '1',
    'OPTIMIZE' => undef,
    'HDF_LIBS' => undef,
    'MALLOCDBG' => {},
    'WITH_MINUIT' => '1',
    'WITH_PLPLOT' => '1',
    'MINUIT_LIB' => undef
    };

    Summary of my perl5 (revision 5 version 12 subversion 3) 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:/asperl/site/bin/gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
    -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -DPERL_MSVCRT_READFIX -DHASATTRIB
    UTE -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:\asperl\site\bin\g++.exe', ldflags ='-L"C:\asperl\lib\CORE"'
    libpth=\lib
    libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmp
    r -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=perl512.lib
    gnulibc_version=''
    Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -L"C:\asperl\lib\CORE"'

     
  • Chris Marshall
    Chris Marshall
    2011-04-29

    I can also reproduce on cygwin now. I guess I was just "lucky" before.

     
  • Derek Lamb
    Derek Lamb
    2011-04-29

    good to know, I guess. I don't get a core dump, so there's no core to examine with gdb. Running under the perl debugger shows that at the call to rangeb some functions in the Carp module get called. Will provide more info later.

    I'm not sure of the difference between an empty piddle and a null piddle. The piddles in my example that print 'Empty' show up as PDL->null when I do a '?vars'.

     
  • Chris Marshall
    Chris Marshall
    2011-05-20

    Another observation---I don't get the segfault if the
    $img array is small (10,10), (100,100), but I do get
    it with (1000,100). Whatever is going on appears
    to be more likely when the piddle is large.

     
  • Chris Marshall
    Chris Marshall
    2011-07-27

    • priority: 5 --> 9
    • milestone: --> critical
     
  • Chris Marshall
    Chris Marshall
    2011-08-05

    This is the same bug as #3307613 so I've marked that one
    as Duplicate. I'm attaching a simple perl program to reproduce
    the issue. The crux of the problem is the rangeb forcing a single
    index in a single dimension in a way that doesn't work
    when the index array is an Empty pdl where ndims == 1 *but*
    dims(0) == 0.

     
  • Chris Marshall
    Chris Marshall
    2011-08-05

    • summary: sever on empty piddle causes segfault --> sever on Empty piddle causes segfault
     
  • Chris Marshall
    Chris Marshall
    2011-08-05

    • assigned_to: nobody --> zowie
     
1 2 > >> (Page 1 of 2)