-
-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Description
Another UB triggered in
Rcpp/inst/tinytest/cpp/ListOf.cpp
Lines 108 to 110 in e5b03df
| CharacterVector listof_names(ListOf<NumericVector> x) { | |
| return x.names(); | |
| } |
The issue is in the definition
Rcpp/inst/include/Rcpp/vector/ListOf.h
Lines 25 to 30 in e5b03df
| template <typename T> | |
| class ListOf | |
| : public NamesProxyPolicy<T> | |
| , public AttributeProxyPolicy<T> | |
| , public RObjectMethods<T> | |
| { |
Since ListOf<T> is a wrapper, it should inherit from NamesProxyPolicy<ListOf<T>> instead, etc. Otherwise, this cast produces the UB:
Rcpp/inst/include/Rcpp/proxy/NamesProxy.h
Lines 82 to 84 in e5b03df
| NamesProxy names() { | |
| return NamesProxy( static_cast<CLASS&>(*this) ) ; | |
| } |
But then we need to avoid using methods that are not part of ListOf<T>, such as get__() and set__() (or define them). PR coming.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels