Segfault on sourceCpp · Issue #25 · Rcpp11/attributes · GitHub
Skip to content

Segfault on sourceCpp #25

Description

@kevinushey

Calling sourceCpp on the following file:

// [[Rcpp::export]]
//List subset_test_list(List x, CharacterVector y) {
//    return x[y];
//}

causes a segfault. Seems to fail here:

(lldb) frame select 4
frame #4: 0x000000010cbda6b6 attributes.so`get_function_signature(txt=0x000000010890ac20, pos=<unavailable>) + 246 at attributes.cpp:37
   34       
   35       // skip comments
   36       while( current_line[0] == '/' ){
-> 37         current_line = CHAR(STRING_ELT(txt, ++pos)) ;
   38       }
   39       
   40       // get everything before the first '{'

from

(lldb) frame select 5
frame #5: 0x000000010cbdb736 attributes.so`parse_cpp_function(txt=<unavailable>, line=<unavailable>) + 38 at attributes.cpp:158
   155    SEXP parse_cpp_function( SEXP txt, SEXP line ){
   156      
   157      int pos = INTEGER(line)[0] ;
-> 158      std::string signature = get_function_signature( txt, pos ) ;
   159      
   160      // find last ')' and first '('
   161      std::string::size_type endParenLoc = signature.find_last_of(')');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions