[Bioc-devel] PROTECT errors in Bioconductor packages

Martin Morgan martin.morgan at roswellpark.org
Thu Apr 6 11:01:34 CEST 2017

Bioc developers,

Tomas Kalibera has developed an offline bug-finding tool written
specifically to detect C PROTECT errors. The tool detects errors in the 
following Bioconductor packages:

affyio affyPLM Biostrings BufferedMatrix chopsticks CNEr crlmm csaw 
DECIPHER DiffBind diffHic DirichletMultinomial EBImage edgeR fabia graph 
GraphAlignment HIBAG immunoClust InteractionSet IRanges metahdep mgsa 
MotIV mzR ncdfFlow PICS PING qpgraph QuasR R453Plus1Toolbox rqubic 
Rsamtools rSFFreader rtracklayer S4Vectors SANTA scran SeqArray SIMLR 
SNPRelate snpStats STAN TargetSearch ternarynet TitanCNA vsn xcms XVector

Additional information and the reports are available at


Each package has its own subdirectory with textual reports and with
DESCRIPTION file with the version of the package the tool has been run on.

Please have a look at reports for your package(s) and fix if necessary.

If you wish to re-run the bug-finding tool on your package after fixing,
please refer to


where installation instructions are available, including a script to
automatically install the tool into a virtual machine.  Still, please be
advised that the automated installation may take long (about 1 hour on a
decent machine).

The tool is not perfect, so assess each report carefully. 'My' packages 
(Rsamtools, DirichletMultinomial) had several false positives (all 
associated with use of an attribute of a protected SEXP), one subtle 
problem (a symbol from a PROTECT'ed package name space; the symbol could 
in theory be an active binding and the value obtained not PROTECTed by 
the name space), and a genuine bug

                 tag = NEW_CHARACTER(n);
                 for (int j = 0; j < n; ++j)
                     SET_STRING_ELT(tag, j, NA_STRING);
                 if ('A' == aux[0]) {
                     buf_A = R_alloc(2, sizeof(char));  # <<- bug
                     buf_A[1] = '\0';
                 SET_VECTOR_ELT(tags, i, tag); # PROTECT tag, too late!

Have fun, and safe coding!


This email message may contain legally privileged and/or...{{dropped:2}}

More information about the Bioc-devel mailing list