[Bioc-devel] big in IRanges 1.9.1

luke at stat.uiowa.edu luke at stat.uiowa.edu
Sat Oct 30 00:08:47 CEST 2010


I reduced an intermittent bug in IRanges to the following:

nr <- 47
idx <- 48:49
for (i in 1:10000)
     if (IRanges:::anyMissingOrOutside(idx, -nr, NULL)) browser()

This should never enter the browser but does reliable for me with 10000 reps.
(R-devel and IRanges 1.9.1)

The problem is code in IRanges:::.bracket.Index that does

     function (idx, lx, nms = NULL, dup.nms = FALSE, asRanges = FALSE,
               allowAppend = FALSE) {
         ...
         if (anyMissingOrOutside(idx, -lx, if (!allowAppend) lx))

If allowAppend it TRUE then the 'upper' argument to
anyMissingOroutside is NULL, and in anyMissingOrOutside this is
converted by as.integer to integer(0), but the C code that is called
looks at the first element without checking the length. Perhaps the
simplest fix is for anyMissingOrOutside to test for NULL and use the
default value in that case; it would probably be good for the C code
to do a sanity check on types and lengths as well.

Best,

luke

-- 
Luke Tierney
Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the Bioc-devel mailing list