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@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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Iñaki Úcar

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to