From m@echler @ending from @t@t@m@th@ethz@ch  Fri Oct  5 12:16:37 2018
From: m@echler @ending from @t@t@m@th@ethz@ch (Martin Maechler)
Date: Fri, 5 Oct 2018 12:16:37 +0200
Subject: [Rd] Seg fault stats::runmed
In-Reply-To: <3e83fd14-fe55-3c45-93cb-57a146d2efaf@mpiib-berlin.mpg.de>
References: <3e83fd14-fe55-3c45-93cb-57a146d2efaf@mpiib-berlin.mpg.de>
Message-ID: <23479.14853.789755.950142@stat.math.ethz.ch>

>>>>> Hilmar Berger 
>>>>>     on Fri, 5 Oct 2018 10:17:49 +0200 writes:

    > Dear all, I just found this issue:

    > I just found this issue:

    > dd1 = c(rep(NaN,82), rep(-1, 144), rep(1, 74))
    > xx = runmed(dd1, 21)

    >> R crashes reproducibly in R 3.4.3, R3.4.4 (Ubuntu 14.04/Ubuntu 16.04)

and also in the latest development version (we call "R-devel").

THank you very much, Hilmar!

I will have a look, to ensure missing values (incl NaN) are
handled propertly.

Martin

--
Martin Maechler
ETH Zurich and R Core Team

    > With GDB:
    > Program received signal SIGSEGV, Segmentation fault.
    > swap (l=53, r=86, window=window at entry=0xc59308, 
    > outlist=outlist at entry=0x12ea2e8, nrlist=nrlist at entry=0x114fdd8, 
    > print_level=print_level at entry=0) at Trunmed.c:64
    > 64??? ??? outlist[nr/* = nrlist[l] */] = l;

    > Valgrind also reports access to unallocated memory and/or writing past 
    > the end of the heap.

    > The crash does not happen if the order is changed:

    > dd2 = c(rep(-1, 144), rep(1, 74), rep(NaN,82))
    > xx = runmed(dd2,21)

    > Error in if (a < b) { : missing value where TRUE/FALSE needed



[Rd] Seg fault stats::runmed
Martin Maechler