From |uc@r @end|ng |rom |edor@project@org  Sun Jun 30 11:21:09 2019
From: |uc@r @end|ng |rom |edor@project@org (=?UTF-8?Q?I=C3=B1aki_Ucar?=)
Date: Sun, 30 Jun 2019 11:21:09 +0200
Subject: [Rd] memory access question
In-Reply-To: <8fb769$bvgmqt@ironport10.mayo.edu>
References: <8fb769$bvgmqt@ironport10.mayo.edu>
Message-ID: <CALEXWq2A2ds3NghYNxzdbCKPisMLYeRW3D8+gdO+UOjT_JstcQ@mail.gmail.com>

It doesn't matter you didn't use the value. An invalid read may fail
or not. It depends on whether that memory portion was reallocated or
not by the OS. When it was, you are trying to read in a memory region
where you don't have permission, so it crashes.

I?aki

On Sun, 30 Jun 2019 at 04:27, Therneau, Terry M., Ph.D. via R-devel
<r-devel at r-project.org> wrote:
>
> I had a problem with the latest iteration of the survival package  (one that I hope to
> post to Github next week) where it would die in strange ways, i.e., work on one box and
> not on another, a vignette would compile if I invoked Sweave myself but fail in R CMD
> build, etc.   The type of thing that says quite loudly that there is a memory issue
> somewhere in a C routine.   The kind that has potential for making you tear your hair out.
>
> In any case, I finally built an ASAN aware version of R on my test box, and it failed on
> something that looked minor.  I was reading one element past one of the input vectors,
> though I never used the value.   In essence I had  "temp = input[i]" one line in front of
> the "if() break" test for i.   (The while loop for i was running from n-1 to 0; one often
> goes from largest to smallest time value in survival code, so i was -1 at the failure).
> I repaired this of course, but with no real hope that it could be the actual issue causing
> my errors.   And now the weird behavior seems to have gone away!  The argument in question
> was about midway on the argument list BTW.
>
> My question is, should I have been as surprised as I am?
>
> And let me give a big thank you to the authors of the "debugging" section of the packages
> guide.  Things that reliably die are one thing, but I don't know how I would have found
> this one without the help.
>
> Terry T.
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
I?aki ?car



[Rd] memory access question
=?UTF-8?Q?I=C3=B1aki_Ucar?=