Skip to content
Prev 4226 / 12125 Next

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

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.