Closed TomAndrews closed 6 years ago
I honestly laughed at:
Expected behavior
No segfault!
Thanks for finding and patching this.
I could pretty regularly get a segfault via:
require(xts)
ts1 <- .xts(1:100, 1:100)
ts2 <- .xts(1:200, 1:200)
i <- index(ts1)
tt <- ts2[i]
After applying:
diff --git a/R/xts.methods.R b/R/xts.methods.R
index c94ac6b..5299061 100644
--- a/R/xts.methods.R
+++ b/R/xts.methods.R
@@ -282,8 +282,9 @@ window_idx <- function(x, index. = NULL, start = NULL, end = NULL)
# Translate from user .index to xts index
# We get back upper bound of index as per findInterval
tmp <- base_idx[firstlast]
-
+gctorture(TRUE)
res <- .Call("fill_window_dups_rev", tmp, .index(x), PACKAGE = "xts")
+gctorture(FALSE)
firstlast <- rev(res)
}
Description
I've been seeing intermitted segfaults in my R code recently. One gave the following output:
Expected behavior
No segfault!
Minimal, reproducible example
I can't reproduce the segfault but you can see the illegal read in valgrind (starting R with
R -d valgrind
)I think you might need to
PROTECT
the return value infill_window_dups_rev
. I'll make a pull request shortly which I think fixes the illegal read.Session Info