Skip to content
Prev 5448 / 63421 Next

Segmentation fault linked to memory? (PR#929)

J.C.Rougier@durham.ac.uk writes:
You really ought to upgrade before reporting such bugs, but I get it
with 1.2.3 as well. Looks like we have an integer overrun issue:

At the point of the crash, we have succesfully allocated "ans" 

(gdb) p ans
$25 = (SEXPREC *) 0x1fe8038
(gdb) p Rf_length(ans)
$26 = 1728000000
(gdb) p/x Rf_length(ans)
$27 = 0x66ff3000

however, measured in *bytes*, that length won't fit in 32 bits, and

(gdb) p/x (Rf_length(ans)*8)/8
$31 = 0x6ff3000

So I suppose that the true length of ans is only

0x6ff3000

which fits fairly nicely with the segfault occurring when you try to
access cell number 82*1440000

(gdb) p/x 82*1440000
$28 = 0x709c200