Skip to content

[R-pkg-devel] "Additional issues" show WRITE outside an array

3 messages · Jiahuan ye, Uwe Ligges, Ivan Krylov

#
Hi,

Recently, my first r package offlineChange
<https://cran.r-project.org/web/packages/offlineChange/index.html>
was uploaded to CRAN, and there are three errors. I already figured out
that two of the three errors are that the depend and import are
inconsistent:

Depends:    R (? 3.5.0)
Imports:        graphics (? 3.6.0), utils (? 3.6.0), stats (? 3.5.1), Rcpp
(? 1.0.1)

But for the last ERROR, which only appears under r-patched-linux-x86_64
<https://cran.r-project.org/web/checks/check_flavors.html#r-patched-linux-x86_64>,
I still can't figure it out.
<https://cran.r-project.org/web/checks/check_results_offlineChange.html>
And there is also an additional issue that I think is related with the
above ERROR:
gcc-ASAN <https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/offlineChange
I am very confused what causes the ERROR. When I tested under windows, the
package works well. And there is error in my codes, why does the ERROR only
appear under linux with certain R version?

Thank you for your help.

Best,
Jiahuan
#
Checks with address sanitizers have to be done with instrumnted R 
versions and take a long time, hence we run these checks less frequently 
and only under one platform (here Linux for simplicity).

Best,
Uwe Ligges
On 26.07.2019 08:50, Jiahuan ye wrote:
#
On Fri, 26 Jul 2019 01:50:36 -0500
Jiahuan ye <jiahuanye431 at gmail.com> wrote:

            
Your code on line 197 of src/min_wgss.cpp causes memory access outside
the block that had been allocated for the best_change_point vector.

I have not read the code in depth, but it looks like the length of
best_change_point should be M at this point. Array indices on the C++
side start with 0 and end at (length-1), so erasing the element at
position M in a NumericVector of length M in Rcpp code results in
undefined behaviour.