Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue when trying to access pointer of zero length vector #7

Closed
tdhock opened this issue Jun 19, 2024 · 1 comment · Fixed by #8
Closed

issue when trying to access pointer of zero length vector #7

tdhock opened this issue Jun 19, 2024 · 1 comment · Fixed by #8

Comments

@tdhock
Copy link
Owner

tdhock commented Jun 19, 2024

there could be zero labels in FLOPART but that causes UBSAN issues https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-UBSAN/FLOPART/tests/testthat.Rout because the current code does

&label_type_vec[0], &label_start_vec[0], &label_end_vec[0], label_count,

which means accessing the first (non-existing) element, then getting its pointer.
RcppCore/Rcpp#1308

maybe we can use one of these methods to get the pointer? https://github.com/RcppCore/Rcpp/pull/1310/files#diff-ea8708322594fed31000f9ccae6b5a9cb7ee93ef33468b392b212f8733bbc0a9 get() ?

@tdhock
Copy link
Owner Author

tdhock commented Jun 19, 2024

probably coming from this test

test_that("can start up", {
  seg.mean.vec <- c(11, 3)
  set.seed(1)
  count <- unlist(lapply(seg.mean.vec, function(m)rpois(10, m)))
  N <- length(count)
  cov.df <- data.frame(
    chromStart=seq(0, N-1),
    chromEnd=seq(1, N),
    count)
  result.list <- FLOPART::FLOPART(cov.df, penalty=5)
  computed.segs <- result.list[["segments_dt"]]
  expected.segs <- data.table(
    chromStart=c(0,10),
    chromEnd=c(10,20),
    status=c("peak", "background"),
    mean=c(mean(count[1:10]),mean(count[11:20])))
  expect_equal(computed.segs, expected.segs)
})

@tdhock tdhock mentioned this issue Jun 19, 2024
@tdhock tdhock closed this as completed in #8 Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant